+ 1
Explain the output of this code:
4 ответов
+ 2
Chetali Shah , yes but how?
0
I guess the output is 10. I am not sure either.
0
See the C structure contains variables for A structure and B structure and both of them have 2 more variable. That means the 4 values passed in c1,c2 will be distributed between them as first 2 values will go in a and last 2 in b.
Now, c1.b.a leads to calling of b variable of B structure and in that we are refering to a variable. The first 2 values of c1 are passed to A structure and last 2 to B structure. And a element being the last gets the last value passed in c1 which is 4.
Similarly, in the case of c2.a.b the A structure gets the first two values and in which b gets 6. So adding 4 and 6 is equal to 10.
0
Coder Kitten thanks bro