L11-1 - (11-1 Array of Structs H&K Chapter 10 Instructor...

Info icon This preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
(11-1) Array of Structs H&K Chapter 10 Instructor - Andrew S. O’Fallon CptS 121 (October 31, 2016) Washington State University
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
C. Hundhausen, A. O’Fallon 2 Review of Structs Recall structs are used to represent real world objects They contain attributes that describe these objects Such as a car, where the attributes of the struct car could include steering wheel, seats, engine, etc. Such as a student, where the attributes of the struct student could include ID#, name, standing, etc. In many cases, we need a list or array of these objects A list of cars representing a car lot A list of students representing an attendance sheet
Image of page 2
C. Hundhausen, A. O’Fallon 3 Arrays of Structs (1) Let’s first define a struct student typedef struct student { int ID; char name[100]; int present; // Attended class or not } Student; Next we will build up an attendance sheet
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
C. Hundhausen, A. O’Fallon 4 Arrays of Structs (2) int main (void) { Student attendance_sheet[100]; // 100 students in the class return 0; } Let’s look at a logical view of this attendance sheet on the next
Image of page 4
Image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 6
Image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern