answersLogoWhite

0

Difference between array and union

Updated: 12/8/2022
User Avatar

Wiki User

11y ago

Best Answer

All the members of the structure can be accessed at once,where as in an union only one member can be used at a time. Another important difference is in the size allocated to a structure and an union. for eg: struct example { int integer; float floating_numbers; } the size allocated here is sizeof(int)+sizeof(float); where as in an union union example { int integer; float floating_numbers; } size allocated is the size of the highest member. so size is=sizeof(float);

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Difference between array and union
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering
Related questions

What is the difference between numeric array and associative array?

Numeric array has numbers(+integers) that represent the values Associative array has strings that represent the values


What is the difference between array and string of array?

When we declare an array of characters it has to be terminated by the NULL , but termination by NULL in case of string is automatic.


Difference between central government and union government?

There is no difference between central and union government


Difference between vector and array list?

Vectors are thread safe but array lists are not. Hence array lists are faster than Vectors.


What is the difference between Land Grid Array and Pin Grid Array?

One has pin in front, one has land


How do you do union array?

typedef union U_t {/*...*/} U; U a[100]; /* an array of 100 unions */


What is Difference between programmable logic array and programmable array logic?

Using and gate - pla is programmable while pal is fixed


What is the difference between a Magician and a Chorus Line?

A Magician has a cunning array of stunts ...........................................................................


Main difference between Array List and Vector in Java?

List is not sync'd as a vector is.


What is the difference between a numericial array and an associative array?

A numericial array is an array with keys made up of only integers. An associative array is an array with keys made up of anything that is not an integer. In some languages, it is possible to mix integer keys and non-integer keys into a mixed array.


Which is used to compute the difference in arrays?

arrayarray_diff(array$array1,array$array2[,array$...] )


What is the difference between an array element and a variable?

Array elements are all members of the same variable, indexed in a logical manner. variables are distinct objects which must be referred to distinctly. The main functional difference is that a program can iterate over an array without the programmer knowing the original size of the array or explicitly which member to access.