typedef struct char fname 30 char lname 30 student typedef

typedef struct { char fname [30]; char lname [30]; student; typedef struct int num char name [30] Student stud[5e]; Course; Assume var has been assigned the address of a Course structure. Course *var malloc ( sizeof (Course)); =

Solution

The answer is 2 only.

1) To access fname from an object (stud) of student struct we need to write (stud.fname). Since it\'s an array of student objects, we have to specify proper index that we want to access, hence, (stud[0].fname) (for the first student).

2)Now this stud object is a member of course sturcture and a pointer var is pointing to one instance of this structure. So, to access any member of course structure using a pointer, we write (var->stud[0].fname)

 typedef struct { char fname [30]; char lname [30]; student; typedef struct int num char name [30] Student stud[5e]; Course; Assume var has been assigned the ad

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site