C determines the number of integer types and sets the ratio of their sizes. Basically, this suggests that sizeof (long long)> = sizeof (long)> = sizeof (int)> = sizeof (short)> = sizeof (char), and sizeof (char) == 1.
But the actual sizes are not defined and depend on the architecture in which you work. On a 32-bit PC, int and long are usually four bytes, and long long is 8 bytes. But on a 64-bit system, the length is usually 8 bytes and therefore different from int.
There is also a type called uintptr_t (and intptr_t) that are guaranteed to be the same size as data pointers.
It is important to remember that you should not assume that you can, for example, store pointer values ββin long or int. Being portable is probably more important than you think, and it is likely that you will want to compile your code on a 64-bit system in the near future.
source share