Example struct student char id 9 char name 30 int mark

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: onalCreate(1, 2) printf("float=%.2f\n", rationalToReal(rationalAdd(rat1, rat2))) return 0 } /* assuming the existence of hcf() */ CSC 1500 { Lecture 11 14 Array of Structures A structure may occur as an array element. Example: struct student { char id 9] char name 30] int mark } int main(void) { struct student ... } stulist 100] id name mark id name mark id name mark id name mark ...... id name mark stulist[0] stulist[1] stulist[2] stulist[3] stulist[99] Entities stulist stulist 2] stulist i].name stulist i].name j] Meaning an array of struct student the 3rd element of stulist array a variable of type struct student the name of the (i + 1)th student in the stulist array a string the (j + 1)th character of the name of the (i +1)th student in the stulist array a single character 15 CSC 1500 { Lecture 11 Readings Chapter 9, Section 9.6 Chapter 12, Sections 12.1 { 12.7 Exercises Chapter 12, Exercises 1, 3, 6, 7, 8, 9, 10 2 End of Lecture 11 CSC 1500 { Lecture 11 16...
View Full Document

Ask a homework question - tutors are online