Size of char type in C

I thought that the size of the types in C are implementation defined. However, I found these size relationships in the script (Chapter 4.6):

The Standard also does not specify the sizes of the integer types. It only guarantees the following relationships:
\begin{equation*} 1 = \mathtt{sizeof(char)} \leq \mathtt{sizeof(short)} \leq \mathtt{sizeof(int)} \leq \mathtt{sizeof(long)} \end{equation*}

This would mean that the size of a char ist 1 byte. I also couldn’t find this in the C specification.

Is the size of a char fixed to 1 byte or implementation defined?

The size of char is 1 char :stuck_out_tongue_winking_eye:

The C standard does not define 1 byte = 8 bit. It defines 1 byte = 1 char, where char is the smallest individually adressible unit of memory and at least 8 bit.

So by reflexivity, the size of char is 1. Everything else is measured in multiples of the size of char.

4 Likes