+ 1

string reversal in gnu c++

in turbo we had strrev function for reversal of a string. bt this functn is not defined in c++ gnu...is there any other fnctn for the same or we need to use the loop method only????

11th Jul 2018, 8:14 AM
Tulika
Tulika - avatar
2 Answers
+ 3
Modern or c-strings? Modern strings can be reversed by the function std::reverse, which is located in the header <algorithm>. For older c-strings you will have to make your own function.
11th Jul 2018, 8:26 AM
Shadow
Shadow - avatar