Lecture34-LIN-11222019-StructureI.pdf - Computing I COMP.1010 Fall 2019 Lecture 34 Structure I By Sirong Lin PhD University of Massachusetts Lowell

Lecture34-LIN-11222019-StructureI.pdf - Computing I...

This preview shows page 1 - 9 out of 26 pages.

By: Sirong Lin, PhD Computing I University of Massachusetts Lowell COMP.1010, Fall 2019 Lecture 34: Structure I
Image of page 1
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Upcoming Due Dates 2 Due Date Week 12 Practice Sunday 9:00pm Week 14 Reading MWF, 9:00am Program 4 12-04-2019, 9:00pm Daily 26 12-06-2019 (F), 9:00pm
Image of page 2
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Outlines Structure in C 3
Image of page 3
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Structure a structure data type access structure member variables examples structure as a member variable a structure pointer 4
Image of page 4
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin 5 Need More Complicated Data Type store today’s date, e.g., 11/22/2019, inside a program Mother’s Day, 5/12/2019 What if we need other dates, e.g., yesterday, tomorrow, purchaseDate… int month = 11, day = 22, year = 2019; int mMonth = 5, mDay = 12, mYear = 2019;
Image of page 5
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin 6 Need More Complicated Data Type three variables (month, day, year) are logically related, good to group them together using Structure
Image of page 6
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin 7 a Structure for storing a date this defines a structure called date that contains three integer member variables month , day , and year struct is a reserved word in C struct date{ int month; int day; int year; };
Image of page 7
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin 8 Structure in C A structure is a collection of one or more variables, possibly different data types, together under a single name. help to organize complicated data e.g., a student record, a point (a pair of coordinates) other examples?
Image of page 8
Image of page 9

You've reached the end of your free preview.

Want to read all 26 pages?

  • Fall '15

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

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors