I wrote code like this
When I ran codeCode:#include<stdio.h>#include<stdlib.h>
struct Name{
char n;
char m;
struct Name *N;
};
void main (){
struct Name *H = (struct Name*)malloc(sizeof (struct Name));
H->n;
H->m;
H->N;
printf("%d \n", sizeof (H->n));
printf("%d \n", sizeof (H->m));
printf("%d \n", sizeof (H->N));
printf("%d \n", sizeof (struct Name));
}
It gives below output
1
1
4
8
so I understand
H->n; take one byte
H->m; take one byte
result say H->N; 4 bytes
I do not understand why does it take 4 bytes ?