Swap function in C++

is swap is inbuilt function in c++?
if yes then how can i use it?

hi @ritikbunty2511_729d0258992e0982,
swap(a, b); // where a and b are 2 variables
you can also use to swap content of array
by swap(arr[0], arr[1])
or of string by
swap(s[0],s[1])

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.