1. No ";" after line 11 (Your lines)
2. do-while unnecessary
3. array[row = 3] @ line 19 is flawed syntax. You set row equal to 3, and check if array[3] is not equal to 0. array[x] is never equal to zero because it's a multi-dimensional array and should thus be implemented as an int **.
4. <= prints 0-3 elements, 4 elements total. You only have 3.
5. You can generalize the enter number expression by simply incrementing (I used arithmetic), which changed line 18.
3. array[row = 3] @ line 19 is flawed syntax. You set row equal to 3, and check if array[3] is not equal to 0. array[x] is never equal to zero because it's a multi-dimensional array and should thus be implemented as an int
thanks for the help but i was wondering if you could elaborate this statement for me im trying to understand it but you kinda lost me there. :)
The first thing that happens is that you assign 3 to row. Now you have (how the computer interprets it):
array[3]
What value does that give you? It gives you a value that points to another array. However, 3 is out of bounds since you the only valid ones are 0, 1, and 2. These are the 3 elements you declared the array with.
I don't know if you know about pointers, but these are quite equivalent:
1 2
int **array_1;
int array_2[3][3];
Thus:
1 2
array_1[int]; // returns int *
array_2[int]; // returns int *
When we put numbers inside if statements, and such number is not 0, then the expression evaluates to true. It's really hard to explain if you don't know about pointers =/.