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 |
Define a structure to store the record of library. The record must consist of at least following fields: Title, Author, Edition, Price, Publisher, and Category. -Define functions authorSearch ( ), TitleSearch ( ) and CategorySearch ( ) to search a book with respect to author, title and category. [There can be more than one book, written by one author, in one category]
what is the need for main function in c?
Explain the priority queues?
how to find the size of the data type like int,float without using the sizeof operator?
why do we use # in c-language?
how can i print "hello"
What is the best way of making my program efficient?
can we change the default calling convention in c if yes than how.........?
Which header file is essential for using strcmp function?
Define function ?Explain about arguments?
2 Answers Geometric Software, Infosys,
What is a macro in c preprocessor?
what is the use of ~ in c lang?????