Solution Review: Mirror a 2D Array
Have a look at the solution to the 'Mirror a 2D array' challenge.
We'll cover the following...
We'll cover the following...
Rubric criteria
Solution
Rubric-wise explanation
Point 1:
Look at line 23. We have the header of the mirror function. It takes an integer 2D array (int[][]) as a parameter and also returns an integer 2D array (int[][]).
Point 2:
In lines 28-34, we create a copy of the origArray (argument to the method) because we don’t want to change it.
❌ Note: We can’t do
array = origArray. Because this statement will makearraypoint toorigArray. So, any change inarraywill also be reflected outside the function.
Point 3:
Look at line 26. We have an outer for ...