1.

Write the syntax and an example for structure.

Answer»

Structure is declared using the keyword ‘struct’. The syntax of creating a structure is given below.

struct structure_name

{

type member_name 1;

type member_name2;

}

reference_name;

An optional field reference_name can be used to declare objects of the structure type directly.

Example:

struct Student

{

long rollno;

int age;

float weight;

};



Discussion

No Comment Found