Size of union = size of the largest data type used
The memory occupied by a union will be large enough to hold the largest member of the union. It doesn't matter what is currently in use. For example,
union Data
{
int i;
float f;
char str[20];
} data;
Now, a variable of Data type can store an integer, a floating-point number, or a string of characters. It means a single variable, i.e., same memory location, can be used to store multiple types of data. Data type will occupy 20 bytes of memory space because this is the maximum space which can be occupied by a character string.