Home » C Programming » Unions » Question
  1. What will be the output of the following C code? (Assuming size of char = 1, int = 4, double = 8)
    #include <stdio.h>
    union Example
    {
    int n1;
    double n2;
    char ch;
    }E;
    int main()
    {
    E.ch = 'B';
    E.n1 = 100;
    printf("%d", sizeof(E));
    }
    1. 32
    2. 16
    3. 8
    4. 4
    5. 2
Correct Option: C

8



Your comments will be displayed only after manual approval.