-
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;
}
-
- str
- Compilation Error
- 4
- All of above
- 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.