On Sun, Mar 8, 2009 at 5:20 PM, [email protected] <[email protected]> wrote: > hello just tell me what .. > what is a basic difference between structure and union in clanguage?
In a structure, each member has it's own bit of memory, and changing one does not affect any of the others. In a union, all the membes start at the same 'address' so writing one one member, makes all the others invalid (gross simplification here.) Structures are at least as big as the summation of the sizes of each member. Unions are only at least as big as the biggest member. Conceptually, thing of each member of a struct as being separate from the other members, and the members of a union ovelaying each other. -- PJH http://shabbleland.myminicity.com http://www.chavgangs.com/register.php?referer=9375
