int swap(int *x, int *y)
{
int *tmp;
tmp = x;
x = y;
y = tmp;
return *x, *y;
}
You're assigning the pointers, not their values. Use this instead
void swap(int *x, int *y)
{
int tmp;
tmp = *x;
*x = *y;
*y = tmp;
}
Also, the return means nothing since the values are swapped by the pointers, and you cannot also return 2 values at a time. The return type should be void like @Yu Hao said