Home » C Programming » Unions » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    union
    {
    int n;
    char ch;
    }U;
    int main()
    {
    U.n = 10;
    printf("%d\n", sizeof(U));
    }
    1. sizeof(int)
    2. Depends on the compiler
    3. sizeof(int) + sizeof(char)
    4. Compilation Error
    5. None of these
Correct Option: A

sizeof(int)



Your comments will be displayed only after manual approval.