how to define a structurestructure declarations


How to Define a Structure?

Structure declarations are rather more complicated than array declarations, ever since a structure must be defined in terms of its individual members. Generally the composition of a structure may be defined as

struct tag
{
member 1;
member 2;
member m;
} g;

In this declaration struct is a necessary keyword tag is a name that identifies structures of this kind (structures having this composition) and member 1, member 2, . . . , member m are individual member declarations.

The individual members are able to be ordinary variables, arrays, pointers or other structures. The member names within a particular structure should be distinct from one another, though a member name is able to be the same as the name of a variable that is defined outside of the structure. A storage class but can't be assigned to an individual member, and individual members can't be initialized inside a structure type declaration. Formerly the composition of the structure has been defined individual structure type variables can declare as follows.

storage-class struct tag variable 1, variable 2,..., variable n;

where
storage-class is an optional storage class specifier,
struct is a required keyword,
tag is the type name that is used in the structure declaration,
variable 1, variable 2,...., variable n are structure variables of type tag

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: how to define a structurestructure declarations
Reference No:- TGS0305115

Expected delivery within 24 Hours