# Thread: What is Multi Dimensional Array?

1. ## What is Multi Dimensional Array?

Code:
```int main()
{int a[3][3],i,j;
{for(i=0;i<3;i++)
for(j=0;j<3;j++)
a[i][j] = 0;}
printf("a[i][j] =%d\n",a[i][j]);
return EXIT_SUCCESS;}```
i find it on c ebooks for android phone,
its called multi dimensional array, but when i make a trial and error program
the result of a[i][j] = 2293576
the result was syntac error right?
i didnt get was the multi dimensional array mean,

2. Of course! There is a logical error on this code.

What is the values of i and j when you reach the printf ?

Then think what element of the array(if any) these values represent.

3. yeahh i already figured it out,
when i am using printf to i and j,
it prints out 3 number,
but i didnt get multi dimensional array things from my ebooks says,
and why a didnt get any values?

4. Let me rephrase the question.

If I want to print the left top element of a 2D array, I would do
Code:
```i = 0;
j = 0;
printf("a[i][j] =%d\n",a[i][j]);```
So this code would print me the a[0][0] element.

In the code you have in the first example, in which element is the a[i][j]?

I think that way you really learn to debug, so please don't throw away the answer (for the other members).

5. Originally Posted by loserone+_+
Now fixed:
Code:
```int main()
{  int a[3][3],i,j;

for(i=0;i<3;i++) {
for(j=0;j<3;j++) {
a[i][j] = 0;

}
}
return EXIT_SUCCESS;
}```
i find it on c ebooks for android phone,
its called multi dimensional array, but when i make a trial and error program
The result was syntac error right?
i didnt get was the multi dimensional array mean,
Yes. It had an error. Now, where should that print statement go?

A one dimensional array has length - like one line of text.

A two dimensional array has length and width - like a table on a spreadsheet, or a page of text.

A three dimensional array has length, width, and depth (or height) like several pages of text in a notebook, pad, or book.