How do you reverse a string in place in C or C++?

#include <algorithm>
std::reverse(str.begin(), str.end());

This is the simplest way in C++.

Leave a Comment