I am trying to write a swap method in the form of
swap(T[], int, int)
This method should take an array and swap two of the positions in that array. For example, say I have an array named table and two arbitrary integers in that array called up and down. I would like to be able to use the method swap so that:
swap(table, up, down);
will swap the values at the position of up and down in the given array of table. Could anyone help me out? I know I need to use a temp to store the values but I'm not quite sure what I need to do beyond that.