Difference between Structures and Unions

johnson10001's Avatar, Join Date: Aug 2014
Newbie Member
Hi every one..I am new to programming..Can any one tell me the difference between structures and unions in C
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
There are quite a few difference between struct and union.
  • Structure has memory equal to sum of all member variables where as union has memory equal to hold the largest variable type of all the member variables.
  • In Structure all members variables can be used to store data and retrieve it where as in union only one member variable can be used.
You can read more about unions here along with examples.