Thanks Uhrwerk!
1. Would this free all the allocated memory?
for(tx=0;tx<1000;tx++)
{
for(ty=0;ty<500;ty++)
{
free((Bwater[tx])[ty]);
}
}
Would there be a ton of pointers left-over? If so, how would I remove those?
2. I still dont understand "memset( Bwater[j] , (int)100 , (int)500 * sizeof(int) );"
Running the following code testi=1684300900
int** Bwater = NULL;
int testi;
void test_array()
{
Bwater = (int**)sys_malloc( (int)1000 * sizeof(int*) );
int j;
for (j=0;j<1000;j++)
{
Bwater[j] = (int*)sys_malloc( (int)500 * sizeof(int) );
memset( Bwater[j] , (int)100 , (int)500 * sizeof(int) );
}
testi=(Bwater[999])[499];
}
anyone know why testi=1684300900 instead of 100?
EDIT:
For anyone just popping in that wants to help, the above code is supposed to be a subsitute for an array "int Bwater[1000][500];"
With a final line at the end to use "testi" to retrieve the value of the last position in the array [999],[499] to test if it works.