Sample Code
#include <stdio.h> /* printf */
int main(void)
{
printf("sizeof(short) is %lu\n", sizeof(short));
printf("sizeof(int) is %lu\n", sizeof(int));
printf("sizeof(long) is %lu\n", sizeof(long));
printf("sizeof(long long) is %lu\n", sizeof(long long)); /* C99 */
printf("sizeof(void*) is %lu\n", sizeof(void*));
return 0;
}
Outputs:
32-bit Windows (Microsoft)
32-bit Cygwin (gcc):sizeof(short) is 2 sizeof(int) is 4 sizeof(long) is 4 sizeof(long long) is 8 sizeof(void*) is 4
64-bit Windows (Microsoft LLP64)sizeof(short) is 2 sizeof(int) is 4 sizeof(long) is 4 sizeof(long long) is 8 sizeof(void*) is 4
64-bit Windows (MinGW LLP64)sizeof(short) is 2 sizeof(int) is 4 sizeof(long) is 4 sizeof(long long) is 8 sizeof(void*) is 8
32-bit Linuxsizeof(short) is 2 sizeof(int) is 4 sizeof(long) is 4 sizeof(long long) is 8 sizeof(void*) is 8
64-bit Linux (gcc LP64)sizeof(short) is 2 sizeof(int) is 4 sizeof(long) is 4 sizeof(long long) is 8 sizeof(void*) is 4
32-bit macOS (Clang/gcc)sizeof(short) is 2 sizeof(int) is 4 sizeof(long) is 8 sizeof(long long) is 8 sizeof(void*) is 8
64-bit macOS (Clang/gcc LP64)sizeof(short) is 2 sizeof(int) is 4 sizeof(long) is 4 sizeof(long long) is 8 sizeof(void*) is 4
sizeof(short) is 2 sizeof(int) is 4 sizeof(long) is 8 sizeof(long long) is 8 sizeof(void*) is 8