This question already has an answer here:
Structure pointer returning the start byte of member of structure .I wondered how it works. PLease some one help me to get know about this.
#include <stdio.h>
typedef struct node {
char mem;
double mem2;
char mem3;
int mem4;
char mem5;
char mem6;
}NODE;
int main()
{
NODE * m;
printf("%u",&m->mem3);
return 0;
}
Output is 16
The program actually should crash because pointer m is not pointing valid memory location. Below code can give the result.
%x will give hexadecimal address value.