Interview Questions

Write a function that swaps the values of two integers, using int* as the argument type.

C++ Interview Questions and Answers


(Continued from previous question...)

Write a function that swaps the values of two integers, using int* as the argument type.

void swap(int* a, int*b) {
   int t;
   t = *a;
   *a = *b;
   *b = t;
}

(Continued on next question...)

Other Interview Questions