What is the output of the following program on GCC compiler?

Loading

โœช Choose the correct option.

What is the output of the following program on GCC compiler?

#include 
#include
int main(){
union a{
int i;
char ch[4];
};
union a u;
u.ch[0]=3;
u.ch[1]=2;
u.ch[2]=0;
u.ch[3]=0;
printf("%d %d %d ",u.ch[0],u.ch[1],u.i);
return 0;
}

A. 3 2 0 0
B. -505826
C. compiler error
D. 0 0 0 0

Leave a Comment