I am trying to input three parameters for the swap() since the book that I am currently is utilizing three parameters in the swap(). However, I am not sure how he is able to, given that it produces an error message for me. The book's code is the latter half of the copy of the code I produced. If someone could help me, that would be awesome!
#include <iostream>
usingnamespace std;
int main()
{
int x = 1, y = 2, z = 3;
swap(x, y, z);
cout << x << " " << y << " " << z;
}
void sort (int array[])
{
for (int i = 0; i < 10; i++)
{
int index = findSmallestRemainingElement(array, i);
swap(array, i, index);
}
}
is the swap that takes 3 parameters a user-defined function that then calls std::swap with 2?
I maybe wrong but i thought std::swap only took 2 parameters, either 2 values or 2 arrays to swap.
swap with 3 parameters doesnt sound intuitive to me at all. what do you actually swap with what??