Examveda

What will be the output of the following C code?
#include <stdio.h>
struct p
{
    unsigned int x : 2;
    unsigned int y : 2;
};
int main()
{
    struct p p;
    p.x = 3;
    p.y = 4;
    printf("%d\n", p.y);
}

A. 0

B. 4

C. Depends on the compiler

D. 2

Answer: Option A


This Question Belongs to C Program >> Structure And Union

Join The Discussion

Related Questions on Structure and Union