ASP ScriptingJava ScriptingCGI ScriptingHTMLJavaLanguage CERP Education Links

LANGUAGE C

Union of Structures

     A Union is a memory location that is shared by two or more variables, generally of different types, at different times. That is, a union is a way for a section of memory to be treated as a variable of one type on one occassion, and as a different variable, of a different type, on another occassion.

     It is possible to nest unions , unions in structures , and structures in unions. 

#define RADIO   1 
#define TV         2 
#define WATCH 3
struct radio_spec
{
int no_ bands;
int no_ batteries; 
struct tv_spec
{
int no_speakers;
int tube_size;
};
struct watch_type
{
float power;
};
struct item_type
{
int item_flg; 
union diff_ type;
{
struct radio_spec radio; 
struct tv_spec tv;
struct watch-type watch;
}
item;
};

 


Your Ad Here
Not All Of Your Subscribers Use RSS - AWeber Email Marketing
Your Ad Here