I'm working on swapping indices in a two-dimensional array. I seem to be on the right track, but it's not swapping the array in the way I want.
The first row's index j needs to be swapped with row 2's index j:
for (int j = 0; j < array.length ; j++){
int temp = array[row1][j]
array[row1][j]=array[j][row1]
array[j][row1] = temp ;
}
Any ideas on how to best approach this would be appreciated.
[[0,1,2,3,4],[5,6,7,8,9]]to[[5,6,7,8,9],[0,1,2,3,4]]?