Wednesday, August 12, 2015

Structures

While reading in the book "The complete C Reference". I got some notes!


Structures, Unions and Enumerations are declared/defined similar to each other

  • struct tag{   type member_name;
       type member_name;   type member_name;
    } variable_list;
  • union tag{   type member_name;
       type member_name;   type member_name;
    } variable_list;
  • Enumeration tag{   enumeration list
    } variable_list;
Where, tag is optional, variable list is optional, but at least one of them must exist

  • For bit fields, the bits runs from left to right or from right to left dependent on the machine
  • typedef syntax:
    typedef type_name new_name;

No comments:

Post a Comment