Each of the variables you are calling sizeof
on is actually a pointer to a variable. These pointers, in a 64-bit application, will always be 8 bytes (8 bytes x 8 bits per byte = 64 bits), regardless of what type of variable they point to. In a 32-bit application, they would return 4 bytes (4 bytes x 8 bits per byte = 32 bits). This is because a pointer is an address to a memory location, and the size of this address is not dependent upon the size of the variable to which the pointer is pointing.
You can calculate the size of the variable to which the pointers are pointing by dereferencing the pointers in the sizeof
function:
printf("Size of short variable = %d bytes\n", sizeof(*A));
printf("Size of integer variable = %d bytes\n", sizeof(*B));
printf("Size of long variable = %d bytes\n", sizeof(*C));
This will output the following (may depend on compiler):
Size of short variable = 2 bytes
Size of integer variable = 4 bytes
Size of long variable = 4 bytes