As I showed in a recent post, cute XOR tricks to swap a pair of values are likely to make things worse rather than better.
> s = reverse_str("mango");
> output > segmentation fault
> why ??
"strings" can be placed in read-only memory (you can't change read-only memory)
As soon as you try and swap a pair of characters, its game over for you
char a[] = "mango";
s = reverse( a );
should work, if reverse() does as advertised.