{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# array - Programming Arrays 102 Prog Fundamentals I Arrays...

This preview shows pages 1–8. Sign up to view the full content.

Arrays Programming

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

View Full Document
P102 Prog. Fundamentals I: Arrays / Slide 2 Arrays An array is a collection of data elements that are of the same type (e.g., a collection of integers, collection of characters, collection of doubles).
P102 Prog. Fundamentals I: Arrays / Slide 3 Arrays 1-dimensional array. 3-dimensional array (3rd dimension is the day). Oct 15 Oct 16 Oct 14

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

View Full Document
P102 Prog. Fundamentals I: Arrays / Slide 4 Array Applications Given a list of test scores, determine the maximum and minimum scores. Read in a list of student names and rearrange them in alphabetical order (sorting). Given the height measurements of students in a class, output the names of those students who are taller than average.
P102 Prog. Fundamentals I: Arrays / Slide 5 Array Declaration Syntax: <type> <arrayName>[<array_size>] Ex. int Ar[10]; The array elements are all values of the type <type>. The size of the array is indicated by <array_size> , the number of elements in the array. <array_size> must be an int constant or a constant expression. Note that an array can have multiple dimensions.

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

View Full Document
P102 Prog. Fundamentals I: Arrays / Slide 6 Array Declaration // array of 10 uninitialized ints int Ar[10]; -- -- -- -- Ar -- -- -- -- -- -- 4 5 6 3 0 2 8 9 7 1 0 1 2 3 4 5
P102 Prog. Fundamentals I: Arrays / Slide 7 Subscripting Declare an array of 10 integers: int Ar[10]; // array of 10 ints To access an individual element we must apply a subscript to array named Ar. A subscript is a bracketed expression. The expression in the brackets is known as the index. First element of array has index 0. Ar[0] Second element of array has index 1, and so on.

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern