Assign one line in the array to the other one

Viewed 36

I have i think really stupid question, but can I assign one line in the two dimensional array to be "stuck" with the other? What I mean is that I want to sort my array by one line but i want the other line to change as well.

I have an array in which one line is ID of the Container and in the other is the weight of the container. It looks somewhat like this:

 [1,2,3,4,5]

  
[3.2,2.3,6.5,9.3,5.6] 

And when I sort the second line (weight) the upper doesn't change, and I want it to change as well because it's the id of the container and the weight is also connected this container.

0 Answers
Related