Union in C

 1. Write a C program to find the size of total memory allocated when using union.

#include<stdio.h>

union emp

{

    int id;

    char name[10];

    char address[15];

};

int main()

{

    union emp e;

    printf("The maximum size of data is %d",sizeof(union emp));

    return 0;

}


Comments