Anonymous Union
A Union with out a name is called Anonymous,means members of that union cannot be accessed directly.
Ex:
struct
{
char code;
union
{
char ch;
int num;
};
char *name;
} S={'j',97,"zyxwvu"};
int main()
{
int rslt;
rintf("structure members\n");
printf("code %c\nch is %c\nnum %d\nname %s\n",S.code,S.ch,S.num,S.name);
rslt = ({
int a = 5;
int b;
b = a + 3;
});
printf("rslt is %d\n",rslt);
getch();
return 0;
}
Thursday, December 4, 2008
Subscribe to:
Post Comments (Atom)

0 comments:
Post a Comment