C++ Programming Question:
Write a function that swaps the values of two integers, using int* as the argument type.

Answer:
void swap(int* a, int*b) {
int t;
t = *a;
*a = *b;
*b = t;
}
int t;
t = *a;
*a = *b;
*b = t;
}
Previous Question | Next Question |
What is public, protected, private in C++? | Tell how to check whether a linked list is circular. |