Week9Chap7-I

Week9Chap7-I - Chapter 7 Arrays Janaka Balasooriya CSE 110,...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Janaka Balasooriya CSE 110, Arizona State University Chapter 7 Arrays
Background image of page 1

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

View Full DocumentRight Arrow Icon
Janaka Balasooriya CSE 100, Arizona State University From the Last Lecture: Requirement to Store More Than One Data Item in a Variable Suppose we need to store exam 1 grades of CSE110 students. How do we tackle this problem? declare a variable for each student. int student1Score; int student2Score; int student3Score; This is not a good strategy as we need large number of variables. Thus, it is convenient to have a one data structure that can store all exam 1 scores. => Array Arrays can store more than one data value at a given time.
Background image of page 2
Janaka Balasooriya CSE 110, Arizona State University Arrays: From the Last Lecture • Arrays can store more than one data value at a given time. It has fixed number of elements of the same data type. Syntax of Declaring an Array: dataType [] arrayName = new dataType [number_of_elements] Example: int[] scores = new int[5]; First item Second item Fifth item
Background image of page 3

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

View Full DocumentRight Arrow Icon
Janaka Balasooriya CSE 100, Arizona State University
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/08/2010 for the course CSE 110 taught by Professor Kim during the Spring '08 term at ASU.

Page1 / 12

Week9Chap7-I - Chapter 7 Arrays Janaka Balasooriya CSE 110,...

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

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