size of int variable

It depends on the implementation. The only thing the C standard guarantees is that

sizeof(char) == 1

and

sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long) <= sizeof(long long)

and also some representable minimum values for the types, which imply that char is at least 8 bits long, int is at least 16 bit, etc.

So it must be decided by the implementation (compiler, OS, …) and be documented.

Leave a Comment