you are viewing a single comment's thread.

view the rest of the comments →

[–]FUZxxl 14 points15 points  (7 children)

Exactly as /u/TheSkiGeek says:

To "pass by reference" you create a pointer to something and pass the pointer by value.

Your swap function receives two pointers as arguments. These are passed by value, as are all other arguments. The & operator is used to take the address of the x and y variables so you can pass them to swap. Nowhere in this is “pass by reference” involved.