2d array problem with vc++
Hi, I am new to Visual C++.
I have a 2d array in my function.
char array[MAX][MAX];
I then fill in the contents of the array, say, like this:
array[0][0]='a';
array[0][1]='b';
array[0][2]='\0';
Now when I run the debugger and want to view the contents of the 2D array,
I don't see them.
If I type this in my watch window:
array[0]
it says "error: index 0 out of bounds for pointer/array 'array' "
same error comes up if I type something like this in my watch window:
array[0],4
Can anyone tell me what I am doing wrong? I really need to be able to view contents of my 2d array!
Thanks for any ideas.
Re: 2d array problem with vc++
Quote:
Originally posted by LiLgirL
Hi, I am new to Visual C++.
I have a 2d array in my function.
char array[MAX][MAX];
I then fill in the contents of the array, say, like this:
array[0][0]='a';
array[0][1]='b';
array[0][2]='\0';
Now when I run the debugger and want to view the contents of the 2D array,
I don't see them.
If I type this in my watch window:
array[0]
it says "error: index 0 out of bounds for pointer/array 'array' "
same error comes up if I type something like this in my watch window:
array[0],4
Can anyone tell me what I am doing wrong? I really need to be able to view contents of my 2d array!
Thanks for any ideas.
type what in your watch window??
array[0] !!!!
for sure it won't work ... you are working on 2d array not 1d array
but can you simply tell me what is your program about and what is required from the program so it can be more clear?