Cannot access char array

Hi I'm new to c++ but I'm basically trying to access a 2D char array in my code, but it always exits the program when it gets to this point. I have no error messages at all, I don't understand it.

DECLARED IN HEADER FILE
private:
char myArray[50][50];

CODE IN SOURCE FILE METHOD FOR SAME CLASS
int i, j;

for (i=0; i<50; i++)
{
cout << "debugging: confirm this stage reached ok";
for (j=0; j<50; j++) cout << "array char:" << myArray[2][2] << endl; //always exits at this point! (cout is used for debugging)
...
}

note this array was initialised in the class constructor:
int i, j;
for (i = 0; i < 50; i++)
for (j = 0; j < 50; j++)
myArray[i][j] = ' ';


Help to understand why this happens would be appreciated.
Last edited on
Hi , it should work .. there is no reason that it should not exit ..
The code is ok. May the case is not what you think. It could be somewhere else which didn't function supposedly.
If you run your code under a debugger, it will tell you which line causes an error.
Topic archived. No new replies allowed.