Home » C Programming » Bit Fields » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    struct N
    {
    unsigned int x : 1;
    unsigned int y : 1;
    };
    int main()
    {
    struct N n;
    n.x = 10;
    n.y = 20;
    printf("%d\n", n.y);
    }
    1. 0
    2. 1
    3. 10
    4. 20
    5. Garbage value
Correct Option: A

0



Your comments will be displayed only after manual approval.