Treating a 2D array as a 1D array....
Is it more efficient to treat a 2D array as a 1D array in C? If I had a 2D array, array and I accessed it via a pointer arrayPtr++ for all 63 elements. As opposed to two for loops, doing array[i][j]. Or is there no difference at all? Is it better to do one or the other? Or are they both equal statements and it depends on what I feel like doing?
**NOTE: this is just example code to illustrate my meaning, please don't comment on the code, I did not write it with the intent to compile or run it.
arrayPtr = &board;
for( i=0; i<63; i++ )
char ch = *arrayPtr++;
for( i=0; i<8; i++ )
for(j=0; j<8; j++ )
char ch = board[i][j];