Re: initializing a array...
I might have a clue.
Use the for {...} statements like this:
for (int y=0; y<11; ++y)
{
...
I believe that the 'x' and 'y' variables are unassigned and can be of any value.
It is sheer luck that some values in the array are '0'.
/Johan
Re: initializing a array...
Sorry...
I saw another mistake:
Do like this:
for (int y=0; y<12; y++)
{
Increase y afterwards. Otherwise, position [0] in the array won't be assigned.
Remember the array is indexed 0, 1, 2, ..., 11 if you initialize it with MyArray[12];
/Johan M
Re: initializing a array...
> BOOL myArray[12][11];
This defines the array, reserving memory for it, but it doesn't initalise it. You have to initialise it yourself. The only time things get initialised to zero by default is when they are declared static.
With an plain 'C'-style array like this, you can either use for/next to loop through, initialising each element individually, or you can treat it like a block of memory and use memcpy or FillMemory to write the required values all at once (this last is only safe with plain 'C'-style arrays, *not* with array classes).
Dave
Re: initializing a array...
Try
CMyDoc::CMyDoc()
{
...........
for (int y=0; y<11; y++)
{
for(int x=0; x<12; x++)
{
myArray[x][y]=FALSE;
}
}
....................
}