what are the advantages & disadvantages of unions?
Answers were Sorted based on User's Feedback
Answer / vishnu nayak
Union occupy same memory area for different members in a
union.
Same are is allocated for different data types of the
members of union
eg:
union
{
int a;
char c;
float f;
}temp;
Size of Float will be size of union.
same memory is used for char and int as well.
Advantages: Memory consumption is less.
Disadvanteges: if one of the member variable is updated the
it will be reflected in the remaining 2 variables.
| Is This Answer Correct ? | 62 Yes | 18 No |
Answer / vadivelt
Main disadvantage is, all the union member variables cannot
be initialised or used with different values at a time.
| Is This Answer Correct ? | 45 Yes | 14 No |
Is reference used in C?
Explain the concept of "dangling pointers" in C.
biggest of two no's with out using if condition statement
What should malloc(0) do?
What is main () in c?
how to TOGGLE Nth bit of variable in a MACRO
list the no of files created when c source file is compiled
nic scientist exam
What is #define?
control 50 devices which has 2 states on and off.using bitwise operator.plz answer it its urgent
Explain what are the standard predefined macros?
what is the role you expect in software industry?