Look, when you pass x and y to swap; what you are actually doing is : you are creating temporary copies of x and y and pass them to swap.
So, obviously your original variables are not altered 'cuz they are not involved in the operations inside the func. The func only receives two values that are copies of the originals, NOT the originals themselves.

Unfortunately C does not support call-by-reference.
But you can simulate it this way
Code: C
void swap(int *x, int *y)
      int temp;
      temp = *x;
      *x = *y;
      *y = temp;

Hope I cleared your doubt.

BTW, it looks like this is your first post.
So, Welcome to G4EF.

And please ALWAYS post your code inside code-blocks.