Check out example codes for "reverse string efficient in cpp without using function". It will help you in understanding the concepts better.

Code Example 1

#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;
}

Code Example 2

// A quickly written program for reversing a string 
// using reverse() 
#include <bits/stdc++.h> 
using namespace std; 
int main() 
{ 
    string str = "geeksforgeeks"; 
  
    // Reverse str[begin..end] 
    reverse(str.begin(), str.end()); 
  
    cout << str; 
    return 0; 
}

Code Example 3

// A Simple C++ program to reverse a string 
#include <bits/stdc++.h> 
using namespace std; 
  
// Function to reverse a string 
void reverseStr(string& str) 
{ 
    int n = str.length(); 
  
    // Swap character starting from two 
    // corners 
    for (int i = 0; i < n / 2; i++) 
        swap(str[i], str[n - i - 1]); 
} 
  
// Driver program 
int main() 
{ 
    string str = "geeksforgeeks"; 
    reverseStr(str); 
    cout << str; 
    return 0; 
}

Learn ReactJs, React Native from akashmittal.com