In C, structures can be nested. A structure can be defined within in another structure. The members of the inner structure can be accessed using the variable of the outer structure as shown below: 1 outer–struct–variable.inner–struct–variable.membername An example for a nested structure is shown below: 1 2 3 4 5 6 7 8 9 10 11 12 struct student { struct { char fname; char mname; char lname; }name; char grade; }; struct student s1; strcpy(s1.name.fname, “satish”); In the above example, student is the outer structure and the inner structure name consists of three members: fname, mname and lname.
The post How to use functions and substructures in C programming appeared first on Coding Security.
How to use functions and substructures in C programming
read more
Tidak ada komentar:
Posting Komentar