Answer to Question #49849 in C++ for mishal

Question #49849
write a program to swap two values by passing pointer as arguments to the function.
1
Expert's answer
2014-12-09T01:22:18-0500
///////////////////////////////////////////
template <typename T>
void swap(T* left, T* right)
{
T temp = *(left);
*(left) = *(right);
*(right) = temp;
}

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


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

Assignment Expert
15.12.14, 21:02

Dear mishal, You're welcome. We are glad to be helpful. If you liked our service please press like-button beside answer field. Thank you!

mishal
15.12.14, 12:38

thank u so much!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS