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;
}
Discussion:
83 comments Page 7 of 9.
Smit said:
1 decade ago
Good Logic Bro.
But it also in structure?
But it also in structure?
Olaf said:
9 years ago
The output is just some garbage number.
Praveena said:
9 years ago
Nice explanation. Thank you @Srividhya.
Prashanth said:
1 decade ago
David Rajesh your explanation is good
Bhoomika said:
9 years ago
Yes, I will agree with you @Rishabh.
Divya said:
1 decade ago
Good answer Srividhya & Rishabh
Doni said:
1 decade ago
Srivdiya n Risbah answers are good.
Vinitha said:
1 decade ago
I understood the union concept.
Karpakam said:
1 decade ago
Good explanation Viswakethu.A
Arunya said:
9 years ago
I also agree with Srividhya.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers