Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

swap elements array c++

// Funtion that swaps array values
void swap(int &a, int &b){
  int temp = a;
  a = b;
  b = temp;
}
// the "&" is very important, since arrays are not mutable we 
// use this operator to swap memory addresses
Source by www.cplusplus.com #
 
PREVIOUS NEXT
Tagged: #swap #elements #array
ADD COMMENT
Topic
Name
2+5 =