Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

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;
}
Source by www.cplusplus.com #
 
PREVIOUS NEXT
Tagged: #swap #values #array
ADD COMMENT
Topic
Name
8+8 =