?
What will be the output of the following C code?
What will be the output of the following C code?
#include <stdio.h>
union u
{
struct
{
unsigned char x : 2;
unsigned int y : 2;
}p;
int x;
};
int main()
{
union u u;
u.p.x = 2;
printf("%d\n", u.p.x);
}
#include <stdio.h>
union u
{
struct
{
unsigned char x : 2;
unsigned int y : 2;
}p;
int x;
};
int main()
{
union u u;
u.p.x = 2;
printf("%d\n", u.p.x);
}
Join the Discussion
Login to post a comment or share your explanation.
Login