# Data Types — C Programming Fundamentals: Pointers, Memory and Files

Source: https://www.skillbyai.com/en/c/c-data-types

> Know the sizes of char, int, float and double, measure them with sizeof and avoid overflow surprises.

## The basic types

`char` 1 byte · `int` 4 bytes · `float` 4 bytes · `double` 8 bytes · `bool` via `<stdbool.h>`. Modifiers: `short`, `long`, `long long`, `unsigned`.

## Check a size

`sizeof` reports bytes at compile time.

```c
#include <stdio.h>
int main(void) {
    printf("int is %zu bytes\n", sizeof(int));
    return 0;
}
```

Output:

```
int is 4 bytes
```

## Overflow wraps

`unsigned char c = 255; c = c + 1;` makes `c` become `0`. Integer types wrap around at their limits.
