I have executed the following program
The output was - 100 200 300.
struct test testObj;
testObj.a = 100;
testObj.b = 200;
testObj.c = 300;
printf("%d %d %d \n", testObj, testObj, testObj);
I was expecting ouput as - 100 100 100.
Can anyone explain why the output is like this?
I tried looking into the assembly code for the same program and I found that before a call to printf the elements are pushed into the stack as following
When I replaced the printf statement with the following one
still I got the same o/p (even the assembly was also the same).
printf("%d %d %d \n", testObj, testObj, testObj.b);
Is it related to the compiler?