By the way I found a forum discussion that provides suggestions, which are basically that you cannot get around programming with pointers of pointers and a for loop as in this:
I believe you have to create an array of pointers to an array of ints to get this to work. Here is an example:
int **array_ptr; //two * are needed because it is a pointer to a pointer
array_ptr=new int*[firstnumber]; //creates a new array of pointers to int objects
for(int i=0; i<firstnumber; ++i)
array_ptr[i]=new int[secondnumber];
//now, you can access the members like you can with normal 2d arrays
//like array_ptr[1][3]
int **array_ptr; //two * are needed because it is a pointer to a pointer
array_ptr=new int*[firstnumber]; //creates a new array of pointers to int objects
for(int i=0; i<firstnumber; ++i)
array_ptr[i]=new int[secondnumber];
//now, you can access the members like you can with normal 2d arrays
//like array_ptr[1][3]
To copy to clipboard, switch view to plain text mode
The nice thing is that you can access the array members as if it were a 2d array
Bookmarks