C Programming - Structures, Unions, Enums - Discussion

Discussion Forum : Structures, Unions, Enums - Find Output of Program (Q.No. 2)
2.
What will be the output of the program ?
#include<stdio.h>

int main()
{
    union var
    {
        int a, b;
    };
    union var v;
    v.a=10;
    v.b=20;
    printf("%d\n", v.a);
    return 0;
}
10
20
30
0
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
83 comments Page 8 of 9.

Vasant said:   9 years ago
I also agree with Srividhya.

RamDas said:   1 decade ago
Sridivya your answer is good

Vinay said:   1 decade ago
Ya I agree with you rishabh.

Maddy said:   1 decade ago
Nice expalanation vedavathi.

Rasagnaa said:   2 decades ago
Yes I agree with srividya.

Vijayabaskar said:   1 decade ago
Ya! agree with Sreevidhaya

Ashish said:   1 decade ago
Good answer Dinesh.....

Mari said:   1 decade ago
Good answer srividhya.

Shobana said:   2 decades ago
How it will print 20?

Venkat g said:   7 years ago
Thanks @KPS Lubana.


Post your comments here:

Your comments will be displayed after verification.