what are the advantages & disadvantages of unions?
Answer Posted / 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 |
Post New Answer View All Answers
What does 1f stand for?
Why shouldn’t I start variable names with underscores?
What is meant by operator precedence?
What is main return c?
Why does everyone say not to use scanf? What should I use instead?
What are identifiers and keywords in c?
Describe the difference between = and == symbols in c programming?
Who invented bcpl language?
What is a substring in c?
What is pre-emptive data structure and explain it with example?
What are the disadvantages of external storage class?
Can you write the algorithm for Queue?
What is function in c with example?
What are the different categories of functions in c?
What are the two types of functions in c?