C Programs Unions In C C Program to understand concept of Union Union A union is a user-defined data type available in C that allows all members to store different data types in the same memory location. You can define a union with many members, but only one member can contain a value at any given time. Example Keyword used to define it is union. Like here, the union variable Emp has used […]
Unions In C C program to find the size of a union Method 1 Without using sizeof operator #include<stdio.h> union student{ int roll; char name[100]; float marks; }; int main(){ union student *ptr = 0; ptr++; printf("Size of the union student: %d",ptr); return 0; } Output Size of the union student: 100