two-dimensional arrays

Your page rank:

Total word count: 198
Pages: 1

Calculate the Price

- -
275 words
Looking for Expert Opinion?
Let us have a look at your work and suggest how to improve it!
Get a Consultant

declaration
declare a two dimensional array

String chessboard [ ] [ ]; int tictactoe [] [];

declaration-initialization
a three demensional array of ints x, with 3row, 2column, each column is an array 4 ints.

int x [] [] [] ={ 3 row } { { } , { } , { } } {3 row, 2 column} { { {},{} } , { {},{} } , { {},{} } } {3 row, 2 column, 4 numbers} { { {5,5,5,5},{5,5,5,5} } , { {7,7,7,7},{7,7,7,7} } , { {8,8,8,8},{8,8,8,8} } }

char array

char tictactoe [] []= {{‘ ‘,’ ‘,’ ‘},{‘ ‘,’ ‘,’ ‘},{‘ ‘,’ ‘,’ ‘}}; careful: ‘ ‘ not " " add ; in the end

creation
you have chessboard, an two dimensional array of strings that has been declared.
now instantiates an 8*8
array of strings and assign it to chessboard

chessboard=new String[8][8]; not String chessboard[] []= new String [8][8]; because chessboard has been declared.

tictactoe has been declared to be a two-dimensional array of integers.
instantiates a 3*3 two-dimensional array of integers and assign it to tictactoe

tictactoe= new int [3][3];

Declare and instantiate a 3×3 two-dimensional array of integers named tictactoe

int tictactoe[] []= new int [3][3];

element access
what is the first element in the first row in array tictactoe

tictactoe [0][0] row position 0 1 2 …. column position 0 1 2 3 ….

an expression show the elements of the first row are all equal

tictactoe[0][0]==tictactoe[0][1] && tictactoe[0][0]==tictactoe[0][2]

show 3 row, 3 column,
two diagonal equal

draw a picture to see the position don’t make mistake 0 1 2 0 00 01 02 1 10 11 12 2 20 21 22

Share This
Flashcard

More flashcards like this

NCLEX 10000 Integumentary Disorders

When assessing a client with partial-thickness burns over 60% of the body, which finding should the nurse report immediately? a) ...

Read more

NCLEX 300-NEURO

A client with amyotrophic lateral sclerosis (ALS) tells the nurse, "Sometimes I feel so frustrated. I can’t do anything without ...

Read more

NASM Flashcards

Which of the following is the process of getting oxygen from the environment to the tissues of the body? Diffusion ...

Read more

Unfinished tasks keep piling up?

Let us complete them for you. Quickly and professionally.

Check Price

Successful message
sending