2-Dimensional Arrays - PowerPoint PPT Presentation

About This Presentation
Title:

2-Dimensional Arrays

Description:

2-Dimensional Arrays One-Dimensional Array The array elements are selected using a one index Two-Dimensional Array A two-dimensional array has two indices. – PowerPoint PPT presentation

Number of Views:235
Avg rating:3.0/5.0
Slides: 10
Provided by: chen70
Category:

less

Transcript and Presenter's Notes

Title: 2-Dimensional Arrays


1
2-Dimensional Arrays
2
One-Dimensional Array
  • The array elements are selected using a one index

3
Two-Dimensional Array
  • A two-dimensional array has two indices.

4
Defining a 2-Dimensional Array
1. Define an array object reference variable 
double a 2. Create the
array and store the location of the first element
of the array in the (array) object reference
variable a new double34
5
Defining an initialized 2-dim. array
6
Accessing elements of a 2-dimensional array
7
Traversing (visiting) all elements in a
2-dimensional array
  • We can use the following nest for-loop to visit
    all elements

8
Using 2-dimensional arrays --- manipulating
pictures
  • This coordinate system is the same one used for
    the Canvas 
  • program

9
Manipulating Pictures (1)
  • The picture consists of many number of (rows of)
    dots
  • A dot is called a pixel.
  • Each pixel has a color...
Write a Comment
User Comments (0)
About PowerShow.com