Top

Discussion

Predict the output of above program. Assume that the size of an integer is 4 bytes and size of character is 1 byte. Also assume that there is no alignment needed.

union test
{
    int x;
    char arr[8];
    int y;
};
 
int main()
{
    printf("%d", sizeof(union test));
    return 0;
}

 

  • A.12
  • B.16
  • C.8
  • D.Compiler Error

Answer: C

No answer description available for this question.

No comment is present. Be the first to comment.
Loading…

Post your comment