Lecture24-LIN-10282019-Array.pdf - Computing I COMP.1010 Fall 2019 Lecture 24 Array Basics By Sirong Lin PhD University of Massachusetts Lowell Upcoming

Lecture24-LIN-10282019-Array.pdf - Computing I COMP.1010...

This preview shows page 1 - 11 out of 31 pages.

By: Sirong Lin, PhD Computing I University of Massachusetts Lowell COMP.1010, Fall 2019 Lecture 24: Array Basics
Image of page 1
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Upcoming Due Dates 2 Due Date Week 9 Reading MWF, 9:00am Program 2 Design and review 10-30-2019 (W), BEFORE class Daily 18 10-30-2019 (W), 9:00pm Program 2 10-30-2019 (W), 9:00pm Week 9 Practice Sun, 9:00pm Daily 19 11-01-2019 (F), 9:00pm
Image of page 2
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Outline Array Basics array as function arguments array and pointer 3
Image of page 3
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Array Basics introduction declaration access each element assignment initialize an array (3 methods) 4
Image of page 4
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Array Concept a typical variable stores one data item 5 Type Name Address Content double double1 65300 7.1 char ch 65308 ‘A’ int i 65309 4
Image of page 5
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Array Concept (Cont’d) 6 An array stores a collection of data items (elements) together
Image of page 6
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Array Concept (Cont’d) an Array in C : uses two or more adjacent (contiguous) memory cells contiguous means “sharing a common border, touch, next or together in sequence” stores a collection of data items of the same type, e.g., double/float numbers 7
Image of page 7
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Array Concept (Cont’d) 8 6 elements in this array each element stores a number all these numbers are floating type Address Content 65300 7.1 65308 15.2 65316 -3.8 65324 -54.9 65332 0.0 65340 12.0
Image of page 8
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Array (I) introduction declaration access each element assignment initialize an array (3 methods) 9
Image of page 9
Work Ready Life Ready World Ready Computing I, F2019, By Dr. Sirong Lin Array Declaration 10 double x[6]; x is an array of 6 doubles.
Image of page 10
Image of page 11

You've reached the end of your free preview.

Want to read all 31 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