unions conserves memory space..The amount of space allocated for union is based on the member which requires largest memory space...so unions are useful for applications involving number of variables,where values need not be assigned to all elements at one time.AnswerIts used to save on space.
For eg. you have a struct for storing information about insurance policy holders. But there are three types of insurances: Home, Life, Auto. Now basic details about policyholders such as name, address, etc is the same no matter what insurance you are talking about. But certain details are different. So by making a union policyinfo in this struct which is a diff internal struct for each of these policies you can save on space. When you are entering info about a Home policy, then you use the common fields AND only the struct for home insurance. You do not even fill/care about the other structs in the union. Upon storage only the Home struct will be stored, and the others will be discarded. Keep a variable in the main struct which indicates the type of insurance policy and so, which of the structs in the union you want to use. This way, you have just one big structure for all policyholders, instead of three -- it provides a common interface and saves on storage.
The above answers are not correct. Unions do not save memory or storage space. Unions allow the same area of memory to be accessed as different data types. The insurance example above would not work.
Unions are useful (often in embedded programming) when it is needed to refer to a data item as two or more different types: e.g. it may be used as an integer for math, but an array of bytes for a serial transmission or a checksum calculation.
For memory preservation, since the space allocated for the union is as big as its biggest member.
Unions provide strength. Unions provide support. Unions protect.
oldest man om earth
There are no advantages of using.
Britain supplied them with weapons. And they won!
advantages of using ICT
In case of structure each variables have their own storage location whereas for unions all the variables share a common memory location. In structure all the variables can be handled at a time but for union only a member can be handled at a time.
What are the advantages of using the Internet for an organisation?
Union labor is usually a group with a low turnover. One advantage of a low turnover is that the labor force is better paid and more motivated to do a good job.
"What is the advantages of using micrometer?
What are all the advantages and disadvantages of using an electronic dairy?
advantages dianvantages of using electornic marketing.
advantages of not being in a union is that you get paid way better and you dont have to pay unions dues. you have individualism also.
What are the Advantages using HTML to create web pages?"
Some of the advantages of using word to convey information
The advantages are the same as using symbols in writing to represent the words.
the advantages and disadvantages of using artificial insulin are... where am i ? whats going on? who are you?
advantages of opera
what are the advantages of using instrument tranformers
the advantages of alkenes is that they are alkenes.
advantages of using mobile
It is fast using
what is advantages of using handphones????
The advantages are that's it's extremely easy to learn, and you can create your own websites using it.