Perhaps a little late, but since it is not marked as solved I will give it a go. In order to swap two variables, denoted 'a' and 'b', using a third variable, denoted 'temp', you need to do the following:
1. place one of the numbers, say the one inside variable 'a', inside 'temp'.
2. then place the value of 'b' inside 'a'.
3. Put previous value of 'a', now placed inside 'temp', into 'a'.
In code it will look like this:
SWAP_NUMBERS(int a, int b) //a and b are given as parameters
{
int temp;
temp = a //step 1.
a = b //step 2.
b = temp //step 3.
}
now (even though you didn't ask but you might find it interesting), there is another way to swap to numbers without using the temp variable. With a simple math trick you can do the swap:
SWAP_NUMBERS_2(int a, int b) //a and b are given as parameters
{
a = a + b;
b = a - b; //now b has the value of a.
a = a - b; //now a has the value of b.
}
Hope that this helps you, and if it does, just mark the thread as solved :)