Is Swap function inbuilt in C++?

we have used swap functions in swapping of elements without making our own swap function. Can we use swap function directly when we code on hacker blocks or we need to write something ?

yes you can use swap function directly
it is an inbulit function present on iostream
so NO need to add extra header file

if you want you can make you own as well

void swap (int&a,int &b){
int temp=a;
a=b;
b=temp;
}