Hello!

I have recently read a section of union.
My attempt
Code:
#include<stdio.h>

union UnionName 
{ 
  int x; 
  int y; 
  int z;
  
 }u1;
 
int main ()
{
    u1.x = 30;
    u1.y = 20;
    u1.z = 10;


    printf ("\n x : %d ", u1.x);
    printf ("\n y : %d ", u1.y);
    printf ("\n z : %d ", u1.z);


    printf ("\n Location of x : %d ", &u1.x);
    printf ("\n Location of y : %d ", &u1.y);
    printf ("\n Location of z : %d ", &u1.z);


    printf ("\n size of union : %d ", sizeof(u1)); 
	
    return 0;
}
x : 10
y : 10
z : 10

Location of x : 4223088
Location of y : 4223088
Location of z : 4223088

size of union : 4

compiler allocate only one memory location 4223088
first member of union will store at memory location 4223088
second member of union will store at memory location 4223088
third member of union will store at memory location 4223088


Each member share the same memory in union while compiler allocate memory for every structure member