Different Between Structure and Union

Different Between Structure and Union  :-


                      Structure

                      Union

We call access all the members of structure at a time.
Only one members can be accessed at a time.
Memory is allocated for all variable.
Memory is allocated for variable which variable require more memory.
All members of structure can be initialized.
Only the first member of a union can be initialized.
Struct keyword is used  to declare structure.
Union keyword is used to declare union.
All  members of structure stores in unique memory location.
All members of union stores in same location.
Syntax

 Struct

    {

       Int a;
       Float b;
  }var;
Syntax

union
    {

     Int a;
     Float b;
    } var;
Instruction pipelining can be implemented easily.
  Instruction pipelining can not be implemented easily.


1 comments:

Anonymous
18 April 2013 at 20:16 comment-delete

Take intο consіderation that somе eneгgу will be useԁ at
peak times in the daу anԁ lesѕ during non usаge tіmes for solar energy systems MA.
When reseаrсhing lеss еxpensiνe electricаl power conserving stгategies
аnd tips I ԁiscοvered this іnformatіon гegarԁing how to
build уouг own homemade solaг
еnergy panel. But beyond thiѕ, we aгe all
also contaіns resοurces neсessaгy for the masѕ production of ρоwеr, manу of which are reneωable, meaning that
theу aгe easіly гeplaceablе.

Reply

Post a Comment

Don't Forget to comment