fork(5) download
  1. #include <algorithm>
  2. #include <iostream>
  3.  
  4. int main(){
  5. char a[20]="car" ;
  6. char b[20]="hotel";
  7. std::cout << "before swap:" << a << ":" << b << std::endl;
  8. std::swap(a, b);
  9. std::cout << "after swap:"<< a << ":" << b << std::endl;
  10. }
  11.  
Success #stdin #stdout 0s 3096KB
stdin
Standard input is empty
stdout
before swap:car:hotel
after swap:hotel:car