Initializing Structure Elements
The elements of a structure van be initialized either seperately using seperate assignment statements or jointly using the notation similar to that used for initializing arrays. The example given below demonstrates how structure elements can be initialized jointly or seperately.
struct student
{
int rollno;
char name[20];
short clas; // class is a reserved word of C++
float marks;
char grade;
} stud1, stud2;
LEARN MORE>>
No comments:
Post a Comment