swap two numbers in array cpp code example
Example: swap values in array c++
#include <algorithm>
#include <iostream>
using namespace std;
int main()
{
int array[]={1, 2};
cout<<array[0]<<" "<<array[1]<<endl;
swap(array[0], array[1]);
cout<<array[0]<<" "<<array[1];
return 0;
}