Home » C Programming » Bit Fields » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    struct M
    {
    char c : 2;
    int n : 2;
    };
    int main()
    {
    struct M m;
    m.c = 2;
    m.n = 1;
    m.c = m.c & m.n;
    printf("%d\n", m.c);
    }
    1. 1
    2. 2
    3. 0
    4. Compilation Error
    5. None of these
Correct Option: C

0



Your comments will be displayed only after manual approval.