I am learning about computer architecture now. Why the data type sizes are different between Linux and Windows operating systems??
This is my sample C code.
#include<stdio.h>
int main(void)
{
printf ("\n-- General Data Type Size --\n");
printf ("char size : %d byte\n", (int)sizeof(char));
printf ("short size : %d byte\n", (int)sizeof(short));
printf ("int size : %d byte\n", (int)sizeof(int));
printf ("long size : %d byte\n", (int)sizeof(long));
printf ("double size : %d byte\n", (int)sizeof(double));
printf ("long double size : %d byte\n", (int)sizeof(long double));
printf ("\n-- Pointer Data Type Size -- \n");
printf ("char* size : %d byte\n", (int)sizeof(char*));
printf ("short* size : %d byte\n", (int)sizeof(short*));
printf ("int* size : %d byte\n", (int)sizeof(int*));
printf ("long* size : %d byte\n", (int)sizeof(long*));
printf ("double* size : %d byte\n", (int)sizeof(double*));
printf ("long double* size : %d byte\n", (int)sizeof(long double*));
return 0;
}
when i compiled and run this code on my windwos 10 64bit with visual studio 10, it show like:
then, when i compiled and run this code on my ubuntu 18.04 64bit. it shows like:
The Windows system shows me the size of long double is 8-byte and long is 4-byte.
But Ubuntu shows me the size of long double is 16-byte and long is 8-byte. Why are the two sizes different? Both have 64-bit environments, and I wonder why they have different values. I'd appreciate it if you could explain.

