Thursday, March 24, 2016

Member Variables

All the subfields i.e the primitive data type variables in structures are called member variables. We can access these member variables using dot(.) operator. We can set and retrieve the member variable of student structure as shown below.
student student_1 = {0};
student_1.roll_number = 20;
strcpy(student_1.name,”Denis Ritchie”);
student_1.class = 12;
student_1.section = ‘A’;
student_1.marks = 96.9;
strcpy(student_1.school_name,”a4academics.com”);

No comments: