Programming Language Union in C Language Question #2696
Single Choice Not Set

QWhat is the output of this C code?

    #include <stdio.h>
    union utemp
    {
        int a;
        double b;
        char c;
    }u;
    int main()
    {
        u.c = 'A';
        u.a = 1;
        printf("%d", sizeof(u));
    }
The output will be: (Assuming size of char = 1, int = 4, double = 8)

ID: #2696 Union in C Language 1,064 views
Question Info
#2696Q ID
Not SetDifficulty
Union in C LanguageTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A 1
  • B 4
  • C 8
  • D 13
Correct Answer

Explanation

8

Share This Question

Challenge a friend or share with your study group.