Hi All,
I was trying a program to understand the behavior of structure variable,
Sample code:
struct temp
{
int a;
int b;
}obj;
int main()
{
obj.a = 10;
obj.b = 7;
/* to see whether obj and &obj both are same
* I was verifying whether structure variables behave as arrays
*/
printf("%d -- %p",obj,&obj);
return 0;
}
I was expecting output to be 10 and address of obj But to my surprise, Actual output is 10 and 00000007
This is bugging me a lot now!!!
Could anyone please help me understand why printf is taking second member and printing its value.