Managing Arrays and Strings 447
13
Exercises ........................................................................................................
- Declare a two-dimensional array that represents a tic-tac-toe game board.
- Write the code that initializes all the elements in the array you created in Exercise
1 to the value^0. - Write a program that contains four arrays. Three of the arrays should contain your
first name, middle initial, and last name. Use the string-copying function presented
in today’s lesson to copy these strings together into the fourth array, full name.
4.BUG BUSTERS:What is wrong with this code fragment?
unsigned short SomeArray[5][4];
for (int i = 0; i<4; i++)
for (int j = 0; j<5; j++)
SomeArray[i][j] = i+j;
5.BUG BUSTERS:What is wrong with this code fragment?
unsigned short SomeArray[5][4];
for (int i = 0; i<=5; i++)
for (int j = 0; j<=4; j++)
SomeArray[i][j] = 0;