Have a look at following code:
#include<stdio.h>
struct Node
{
int data;
struct Node* nxt;
};
int main()
{
int a = sizeof(struct Node);
int b = sizeof(int);
int c = sizeof(int*);
printf("size of Node: %d\nsize of int: %d\nsize of int*: %d",a,b,c);
return 0;
}
following is output of above code:
size of Node: 16
size of int: 4
size of int*: 8
my question is size of integer is 4 byte and size of integer pointer is 8 byte. So sum of these 2 should be size of struct. But why compiler (GCC) says it occupies 16 bytes?