With a dynamic 2D array:
int *arr;
arr = int *calloc(maxrow*maxcol, sizeof(int));
how do you reference the different elements (alternate notation arr[row][col] will not compile). Is pointer arithmetic the solution?
With a dynamic 2D array:
int *arr;
arr = int *calloc(maxrow*maxcol, sizeof(int));
how do you reference the different elements (alternate notation arr[row][col] will not compile). Is pointer arithmetic the solution?
Then you can use arr[row][col] notationCode:int **arr; arr = malloc( maxrow * sizeof(int*) ); for ( i = 0 ; i < maxrow ; i++ ) arr[i] = calloc( maxcol, sizeof(int) );
Awesome. Thanks Salem.