I was checking the size of short , int and long through coding . My expectation was size of all data type modifiers will differ . Suprisingly , size of long and int is same which is 4 byte . I have provided the code and output .I am using 64 bit windows OS and gcc compiler ( downloaded from https://www.msys2.org ). I have to tried to search reason behind it but unfortunately either i was not able to understand or reason is little vague.
#include <stdio.h>
int main()
{
printf("Size of short is %d",sizeof(short));
printf("\nSize of int is %d",sizeof(int));
printf("\nSize of long is %d",sizeof(long));
}
output:
Size of short is 2
Size of int is 4
Size of long is 4