you gave no names to your parameters so i have no point of reference here.
but, if you want to swap values between any variables, including elements in an array, you first need to make some space.
1 2 3
temp = value1;
value1 = value2;
value2 = value1;
equally with an array, its only the syntax that changes.
edit/
imagine you have 2 egg cups with eggs in them, and can only move one egg at a time. you HAVE to put one of the eggs to one side to free up its cup, then you can move the other egg, freeing up ITS cup for the egg you placed to one side.