C-Structures - ECE 175: Introductory C for Engineers...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

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

Unformatted text preview: ECE 175: Introductory C for Engineers Structures and Union Types ECE 175: Introductory C for Engineers - Structures and Union Types Why are structures needed? Students data is organized in multiple arrays studentid[i]: (integer) Student identification number of student i. firstname[i]: (string) First name of student i. lastname[i]: (string) Last name of student i. totalscore[i]: (double) Final score of student i. How do we maintain student list? Increasing order of last name - Easy for entering grades Decreasing order of total score - Easy for assigning final letter grades Operations to swap two students entries at i and i+1 Swap the studentid, firstname, lastname, totalscore The variables are of different types - too cumbersome to write the code Structures: Allows all the fields of a students record to be grouped together User-defined structures help in writing cleaner codes and achieve better performance 2 ECE 175: Introductory C for Engineers - Structures and Union Types Structure type definition User-defined structure type definition...
View Full Document

Page1 / 8

C-Structures - ECE 175: Introductory C for Engineers...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online