how this is possible..?? Plz can anyone elaborate
The variable a is assigned by value 10 and the variable b is assigned by
20 with the union variable v. Then it gives the output of a is 20 instead
of 10. I doesn't get it.
Can any one help me?
#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;
}
I executed the program and I got 20 as output.
No comments:
Post a Comment