I have to rewrite code that references a 2-dimensional array using pointers instead of array operators.
How would I rewrite this:
...
else
array[i][j] = 'x';
...
So, I’m going to be setting the array to ‘x’ at that index. How would I do this with a pointer?
Assuming
arrayischar array[x][y]thenI mean, it’s ugly and I probably wouldn’t do that, but it will work.
returns another
char[]at indexi. So, you then offset again into that usingj. You can (should) break that up into a few lines so that it is easy to scan.