Note : Size of union is based on the size of the largest member of the union .
In this case size of union is based on the largest variable which is double , suppose size of double is 8 bytes .
But , there is array of characters of size 20 is present .
then ,
- first it allocated 8 bytes. But 8<20
- again allocates 8 bytes total is 16 bytes . But 16<20
- again allocate 8 bytes total is 24 bytes and 24 is not smaller than 20
so , all the array of 20 characters can fit in 24 byte .
therefore , ans is 24 bytes in the case of double size is 8 bytes