How to print a 2D-array in C, without using the operator []?
问题 I am trying to print a 2D matrix with using [] , instead I want to use * like a pointer. So with a 1 D array I'd do: *(arr+i) for example. What's the syntax used to replace in matrix[][] ? Here's the code: for (i = 0; i < size; i++) { for (j = 0; j < (size * 2); j++) { printf(" %5d", matrix[i][j]); } printf("\n"); } P.S, I did try several things like: *(matrix+i+j); *(matrix+i)+*(matrix+j); Of course none of that worked. Thank you for your help and time! 回答1: This may depend on how matrix was