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
Why string is used in c?
1. Write a function to display the sum of two numbers in the following ways: By using (i) pass by value (ii) pass by address a. function with argument and with return value b. function with argument and without return value c. without argument , with return value d. without argument , without return value Note: Use pass by address.
What is difference between array and structure in c?
What does the function toupper() do?
What is function prototype?
Is stack a keyword in c?
What are linked lists in c?
Suggesting that there can be 62 seconds in a minute?
What are multibyte characters?
What’s the special use of UNIONS?
Are negative numbers true in c?
What is #define size in c?
What are register variables in c?
What does double pointer mean in c?
Can 'this' pointer by used in the constructor?