What will be the output of the following C code?
#include <stdio.h>
union p
{
int x;
char y;
};
int main()
{
union p p, b;
p.y = 60;
b.x = 12;
printf("%d\n", p.y);
}
#include <stdio.h>
union p
{
int x;
char y;
};
int main()
{
union p p, b;
p.y = 60;
b.x = 12;
printf("%d\n", p.y);
}A. Compile time error
B. Depends on the compiler
C. 60
D. Undefined behaviour
Answer: Option C
Related Questions on Structure and Union
Which of the following can be a member of a structure?
A. Function
B. Another structure
C. Enumeration
D. All of the above

Join The Discussion