I want to store a 2D array of NSObjects using C pointer arrays. I read another StackOverflow question which said that it's possible to do this as follows:
id myArray [10][10];
However I want to allocate the memory dynamically because I don't know how big the table will be before hand.
I understand how to create a 2D pointer array for standard C variable types but I don't know how to do it for the id type. If I were using an int, I'd do something like this:
int ** myArray = (int**) calloc (10, sizeof(int*));
for(int i = 0; i<10; i++) {
myArray[i] = (int *) calloc(10, sizeof(int));
}
Any ideas how to do this with the id data type?