+3 votes
in Class 11 by kratos

Explain the elements of structure definition. Give an example.

1 Answer

+3 votes
by kratos
 
Best answer

struct <structure-tag>

{

list of members

< member variable 3>

} <structure-variable-name1>,<sttructure-variable-name2>;

1.struct:

It is the reserved or keyword used in structure definition.

  1. <structure-tag>:

It is the name given by the programmer and used to identity the structure in future re-definitions. They are used to declare structure variables.

  1. :

Any valid data type in ‘C’.

  1. < member variable 1…4>:

are names of the variables.

  1. <structure-variable-name 1,.2>:

It is used to access the members of the structure. Example:

struct student

{

int SP regno;

char name[20];

char class[5];

char combination[4];

float fees;

} st1, st2, st3;

...