What will be the output of the following C code?
#include <stdio.h>
union
{
int x;
char y;
}p;
int main()
{
p.y = 60;
printf("%d\n", sizeof(p));
}
#include <stdio.h>
union
{
int x;
char y;
}p;
int main()
{
p.y = 60;
printf("%d\n", sizeof(p));
}A. Compile time error
B. sizeof(int) + sizeof(char)
C. Depends on the compiler
D. sizeof(char)
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