I know how to swap 2 variables in c++ , ie you use std::swap(a,b).
std::swap(a,b)
question:
Does the C standard library have a similar function
C
There is no equivalent in C - in fact there can't be, as C doesn't have template functions. You will have to write separate functions for all the types you want to swap.