UW CSE 142 - Study Notes (5 pages)

Previewing pages 1, 2 of 5 page document View the full content.
View Full Document

Study Notes



Previewing pages 1, 2 of actual document.

View the full content.
View Full Document
View Full Document

Study Notes

70 views


Pages:
5
School:
University of Washington
Course:
Cse 142 - Computer Prgrmng I

Unformatted text preview:

Overview University of Washington Computer Programming I Data types of C Nested Data Structures structs within structs Arrays of structs structs containing arrays Sorting an array of structs 2000 UW CSE U 1 Data Types of C U 2 Composite Data Simple data types int double char Atomic chunks of data cannot be pulled apart into components Composite data Arrays Structs Arrays Sequence of variables all of the same type structs Collection of fields of possibly different types Key point variables of any type can be a component of an array or struct For many problems an array or a struct still not sufficient including an array or struct U 3 Nested structs Example Nested struct Layout typedef struct r double x y point width typedef struct size height double width height dimension typedef struct x lower left dimension size y point lower left int line color fill color rectangle line color typedef struct a single point double x y point typedef struct a size double width height dimension typedef struct description of rectangle dimension size point lower left int line color fill color rectangle U 4 fill color U 5 variable declaration rectangle r U 6 U 1 QUIZ Calculating Types Field Selection Use the operator to select a field If the field it itself a struct use again to select its components r r lower left r lower left x size width height lower left x y rectangle R rectangle rp typedef struct double x y point r typedef struct double width height dimension typedef struct line color fill color U 7 dimension size point lower left int line color fill color rectangle R size R lower left R fill color R lower left x R lower left y rp size rp lower left rp line color R size rp size widthU 8 Components in struct Arrays Structures and Arrays pentagon an array of points A struct represents a single record x y Typically computer applications have to deal with collections of such records Examples student records employee records customer records parts records x y pentagon 1 a point structure x



View Full Document

Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view Study Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Study Notes and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?