Question #49849

write a program to swap two values by passing pointer as arguments to the function.

Expert's answer

///////////////////////////////////////////
template <typename T>
void swap(T* left, T* right)
{
T temp = *(left);
*(left) = *(right);
*(right) = temp;
}

///////////////////////////////////////////

LATEST TUTORIALS
APPROVED BY CLIENTS