Hi
I want to find offset of structure elements
Code (which i found on books and internet) to find offset is
I am not able to understand the above code. What is significance of 0 here? The above code is also not portable also. I do not wish to use offsetof right now. Please help me in solution and explanation as well.
I want to find offset of structure elements
Code:
struct { char a; int b; char c; }example;
Code:
unsigned int offset; offset = (unsigned int)(&(((example *)(0))->b));
Comment