for anyone else having a similar problem in the future I leave the final results.
1. final version of the remove function
void remove_array()
{
int ty;
for (ty=0;ty<1000;ty++)
{
sys_free(Bwater[ty]);
}
sys_free(Bwater);
Bwater=NULL;
}
2. final version of the creating function
void create_array()
{
int ty;
Bwater = (int**)sys_malloc( (int)1000 * sizeof(int*) );
for (ty=0;ty<1000;ty++)
{
Bwater[ty] = (int*)sys_malloc( (int)500 * sizeof(int) );
}
}
All tested and seems to work fine. Thankyou very much Uhrwerk, Sivan, and Superku!
3. Even after reading the manual for sys_malloc() and malloc() I never really understood the difference/advantages/disadvatages of using one or the other. (The only difference I understand now thanks to you is that one sets all data to "0" and the other dosn't?) I always used malloc() and free() for my linked lists, but withough understanding why. I will just go with sys_malloc() and sys_free() because you all seem to use those. ^^
EDIT:
For anyone else using this in the future I also leave declaration, assignment and retrieval examples below:
//declaration example
int** Bwater = NULL;
//assignment example
(Bwater[0])[12]=666;
//retrieval example
testi=(Bwater[0])[12];