0
Can anybody explain the code? Output is 4
#include <stdio.h> union u { int a; char c; }u1; int main() { printf("%d",sizeof(u1)); return 0; }
2 Antworten
+ 1
A union allocates a single memory location with the largest data type size inside the union and is shared by all the other members inside it.
So when compared to char, int has larger in size and hence the answer 4.