Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

how to reverse a string in c++

string reverse(string str)
{
    string output;
    
    for(int i=str.length()-1; i<str.length(); i--)
    {
        output += str[i];
    }
    return output;
}
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #reverse #string
ADD COMMENT
Topic
Name
7+7 =