Online C programming exercises

Which method of swapping is better?

void swap1(int x, int y)
{
int temp;
temp = x;
x = y;
y = temp;
}

void swap2(int *px, int *py)
{
int temp;
temp = *px;
*px = *py;
*py = temp;
}
swap1
swap2


Next Exercise