Difference between C Union and Structure

  • The basic difference between structure and union is size difference i.e.
  • When we are working with structure, the size of the structure is some all member variable size but in union maximum size of a member variable.
  • When working with union, memory will be occupied for only one member which is going to get maximum size.
  • Unions occupies less memory, when we are comparing with structures.
  • All properties of the structure can be applied to unions also, except initialization process.
  • When we are working with structure, we can initialize all data members at a time because memory locations are different but in union only one member need to be initialize.
  • When we are working with union, if we initialize multiple members then compiler will gives an error.
CheapSexCams
Responses are currently closed, but you can trackback from your own site.

Comments are closed.

Powered by k2schools
%d bloggers like this: