Sail E0 Webinar
Question
What is the output of the following C code(on a 64 bit machine)?
union Sti
{
int nu;
char m;
};
int main()
{
union Sti s;
printf("%d", sizeof(s));
return 0;
}
Options:
A .  8
B .  5
C .  9
D .  4
Answer: Option D


Since the size of a union is the size of its maximum datatype, here int is the largest hence 4.
Output:
$ cc pgm7.c
$ a.out
4



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers