Union in c

A "union declaration" specifies a set of variable values and, optionally, a tag naming the union. The variable values are called "members" of the union and can have different types. Unions are similar to "variant records" in other languages. 

Example:-

union sign   /* A definition and a declaration */

{

int svar;

char 1[20];

} number;

union time

int i;

char a;

}my;

#include 

int main() 

my.i=6;                                  ../using union variable 

my.a='A';

}

Note:- The size of the structure is sum of the size of each member in the struchture.but size of the union is size

of Largest member in the union because union members are overlaps on each other in memory.

If we declare two structure variables,Both variables are stored in different location

but union stored in same location.

You may also like

What is PHP?

PHP stands for PHP: Hypertext pre-processor, with that PHP standi...

What is ASP.NET?

ASP.NET, the next version of ASP, is a programming framework used...

What is Data Structure?

A data structure is a group of data elements grouped together und...

What is C#?

C# removes some of the complexities and pitfalls of languages suc...

What is Math?

Math is no Definition it has only Calculation.Closure Property of...

What is Oracle?

Based in Redwood, California, Oracle Corporation is the largest s...

Function in java

A function in Java language is a block of code that performs a sp...

Do-While Loop in java

The do-while loop looks like this:do{ this ; and this ; and this ...