Answers for "reverse function in string"

2

reverse string efficient in cpp without using function

#include <iostream>
using namespace std;
int main()
{
    char str[] = "Reverseme";
    char reverse[50];
    int i=-1;
    int j=0;
         /*Count the length, until it each at the end of string.*/ 
          while(str[++i]!='\0');
           while(i>=0)
                    reverse[j++]=str[--i];
            reverse[j]='\0';
      cout<<"Reverse of  a string is"<< reverse;
      return 0;
}
Posted by: Guest on September-16-2020
-1

reverse a string

let t = s.chars().rev().collect::<String>();
Posted by: Guest on February-22-2021

Code answers related to "reverse function in string"

Code answers related to "Javascript"

Browse Popular Code Answers by Language