Home » C Programming » Data Types » Question
  1. What will be the output of the following C code on a 64 bit machine?
    #include <stdio.h>
    union Stir
    {
    int num;
    char ch;
    };
    int main()
    {
    union Stir str;
    printf("%d", sizeof(str));
    return 0;
    }
    1. str
    2. Compilation Error
    3. 4
    4. All of above
    5. None of these
Correct Option: C

Since the size of a union is the size of its maximum data type, here int is the largest data type. Hence the size of the union is 4.



Your comments will be displayed only after manual approval.