I got confused with the size allocation with my gcc compiler, can any one help me how the size get allocated for the following code.
struct node
{
int data;
struct node *next;
};
sizeof(struct node) it gives an output as 16.
struct node
{
int data;
};
sizeof(struct node) it gives an output as 4.
struct node
{
struct node *next;
};
sizeof(struct node) it gives an output as 8.
struct node
{
int data;
struct node *next;
}*link;
sizeof(link) is always 8, even if i add few more elements to structure.