0
2D Array help pls
The expected output looks something like this: Enter number of rows: 3 Enter number of columns: 3 Enter element at row 0, column 0: 1 Enter element at row 0, column 1: 2 Enter element at row 0, column 2: 3 Enter element at row 1, column 0: 4 Enter element at row 1, column 1: 5 Enter element at row 1, column 2: 6 Enter element at row 2, column 0: 7 Enter element at row 2, column 1: 8 Enter element at row 2, column 2: 9 9 8 7 6 5 4 3 2 1 Here is my code https://code.sololearn.com/c7MmfHQnkpbu/?ref=app
1 Answer
+ 4
Hint:
a possible way is just to save of input values from the back of the array, of course if a swap function is not required.
Another way is to map a 2D array to 1D. The index number of 1D array is f(row, col) a function of row and col.