Examveda

What will be the output of the following C code?
#include <stdio.h>
union
{
    int x;
    char y;
}p;
int main()
{
    p.x = 10;
    printf("%d\n", sizeof(p));
}

A. Compile time error

B. sizeof(int) + sizeof(char)

C. Depends on the compiler

D. sizeof(int)

Answer: Option D


This Question Belongs to C Program >> Structure And Union

Join The Discussion

Related Questions on Structure and Union