Can someone please explain me this peculiar output:
#include <stdio.h>
typedef struct node
{
int i;
struct node *next;
}node;
main()
{
node *p,*q;
printf(" %u ",sizeof(node)); // 16
p = (node *)malloc(sizeof ( node ) ) ;
printf(" %p ",p); // 0x1cea010
q = (node *)malloc(sizeof ( node ) ) ;
printf("\n %p ",q); // 0x1cea030
}
I have a 64 bit processor. When the size is shown to be 16 byes, why is 32 byte allocated for the node?? I checked out a 32- bit machine. The addresses had a separation of 8 bytes. With no padding and stuff. So is the difference of 4 bytes solely cause of some padding issue of the 64 bit machine??