1. ## question about multidimensional arrays

Hi,
I am not sure about something. If you are using a multidimensional array like: scores[5][10], is it true that you can only enter data into the second size because the first size acts like a counter? Say: scores[] is an array of 5 players which is an array of 10 scores. So the 5 has to be the number of groups of 10 scores? So I could not enter data into the 5 part? Only the 10 could have data entered into it? This is the code Im trying:
Code:
```#include <stdio.h>

main()

{

int seats[10][20],

enter_class,
first_class, /*first class subscript*/

printf("\nPlease enter you seating class(1 for first class, 2 for business): ");
scanf("%d" , &enter_class);

if(enter_class == 1)
{
for(first_class=0; first_class<10; ++first_class)
{
break;
}

}

else

{

{
break;
}

}
for(first_class=0; first_class<10; ++first_class)
/*contents of array would be printed here*/
}```
A 1 is entered into the first class part of the array each time first class is selected, and a 2 is entered each time for business class.
After the program finishes it would display the contents of the two parts of the array, showing how many times each class were selected.

2. An array of size N may be indexed from 0 to N-1.

3. I dont get it.

Code:
```for(first_class=0; first_class<10; ++first_class)
{
break;
}```
Or first_class here?
Code:
```for ( business_class = 0; business_class < 20; ++business_class )
{
if ( seats[first_class][business_class] == 0 )
{
}
break;
}```
And how do they relate to int seats[10][20]?

5. Are you saying I forgot to initialize them to 0?

6. Well, to something.
Code:
```	int seats[10][20],

enter_class,
first_class, /*first class subscript*/

7. Aren't they initialized to 0 in each for loop?

8. No. Look closely. One half is, the other half ain't. And for each it's the wrong half.

...And how do 2 arrays make you choose an array of 10?

9. in the first for loop, does the second size not belong, and the second for loop the first not belong?
Code:
```for(first_class=0; first_class<10; ++first_class)
{            /*wrong?*/
break;
}

}

else

{

{	           /*wrong?*/
break;
}```
my original question was leaning towards this. Can the first size[10] not accept data because its the number of times of size 2 [20]?

10. If neither first_class nor business_class are defined, what are they here?
Originally Posted by Dave_Sinkula
Code:
```for(first_class=0; first_class<10; ++first_class)
{
break;
}```
Or first_class here?
Code:
```for ( business_class = 0; business_class < 20; ++business_class )
{
if ( seats[first_class][business_class] == 0 )
{
}
break;
}```
And how do they relate to int seats[10][20]?

11. they are defined as integers as subscripts for the two sizes of the array. lol Im too tired

12. The values are not defined. They are declared as ints.

And their values are random. Let me post a couple of random values: 100002345 and 100002346.

And I'm tired too.

13. Dont know what you mean by defined. #define first_class 10

14. Originally Posted by richdb
Dont know what you mean by defined.
Has no known value.

15. So business_class should have the value of 20 here?
Code:
```for(first_class=0; first_class<10; ++first_class)
{