What is an anonymous union and where to apply that ?

Answers were Sorted based on User's Feedback



What is an anonymous union and where to apply that ?..

Answer / swetcha

An anonymous union is a union without a name. It cannot be
followed by a declarator. An anonymous union is not a type;
it defines an unnamed object.

The member names of an anonymous union must be distinct
from other names within the scope in which the union is
declared. You can use member names directly in the union
scope without any additional member access syntax.

Is This Answer Correct ?    4 Yes 1 No

What is an anonymous union and where to apply that ?..

Answer / priya

Anonymous unions are unions that are declared without a class-name or declarator-list.

union { member-list }

Such union declarations do not declare types
but they declare objects
They must also be declared as static if
declared in file scope. If declared in local scope
they must be static or automatic.

Is This Answer Correct ?    3 Yes 0 No

What is an anonymous union and where to apply that ?..

Answer / monisha

anonymous union is a class name.it cannot be followed by
the declarator.it must be declared with the keyword
static.it cannot have protected and private members.

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More C Interview Questions

Whats wrong with the following function char *string() { char *text[20]; strcpy(text,"Hello world"); return text; }

3 Answers   Qualcomm,


Write a program to print “hello world” without using semicolon?

0 Answers  


write a program in reverse the string without using pointer,array,global variable declaration,lib fun only using a function?

5 Answers   HCL,


If one class contains another class as a member, in what order are the two class constructors called a) Constructor for the member class is called first b) Constructor for the member class is called second c) Only one of the constructors is called d) all of the above

0 Answers  


main() { int i=5; printf("%d",++i + i); } output is 10 ------------------------ main() { int i=5; printf("%d",i++ + i); }output is 12 why it is so? give appropiate reason....

2 Answers  






a parameter passed between a calling program and a called program a) variable b) constant c) argument d) all of the above

0 Answers  


where does malloc() function get the memory?

1 Answers  


What is the use of structure padding in c?

0 Answers  


What is the difference b/w Structure & Class?

3 Answers  


is it possible to change the default calling convention in c ?

1 Answers   Aptech,


how do we remove the printed character in printf statement and write next it it

1 Answers  


What will be the result of the following C language program? main() { int a = 0; int b = 20; char x = 1; char y = 10; if(a,b,x,y) printf("Welcome"); }

1 Answers  


Categories