array - Arrays Programming P102 Prog Fundamentals I Arrays...

Info iconThis preview shows pages 1–8. 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 Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: Arrays Programming 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 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. P102 Prog. Fundamentals I: Arrays / Slide 6 Array Declaration // array of 10 uninitialized ints int Ar[10]; -------- Ar------------ 4 5 6 3 2 8 9 7 1 1 2 3 4 5 P102 Prog. Fundamentals I: Arrays / Slide 7 Subscripting ● Declare an array of 10 integers: int Ar[10];...
View Full Document

{[ snackBarMessage ]}

Page1 / 16

array - Arrays Programming P102 Prog Fundamentals I Arrays...

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

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