Is it more efficient to treat a 2D array as a 1D array in C? If I had a 2D array, array[8][8] 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?
Code:**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. 1) arrayPtr = &board[0][0]; for( i=0; i<63; i++ ) { char ch = *arrayPtr++; } 2) for( i=0; i<8; i++ ) { for(j=0; j<8; j++ ) { char ch = board[i][j]; } }