• Tutorials
  • DSA
  • Data Science
  • Web Tech
  • Courses
June 20, 2022 |14.4K Views

C++ Program to Reverse a String

Description
Discussion

In this video, we will see C++ Program to Reverse a string. As we know a string is a collection of characters and a string class is part of the C++ library that supports a lot much functionality over C-style strings.

Reversing a string is nothing but simply replacing the last element of a string in the first position of the string.

Examples:
1) Input string: abcdef
Output string :fedcba

2) Input string: GEEKSFORGEEKS'
Output string: ‘SKEEGROFSKEEG

Here in this, we see three different methods for a reverse a string in C++.
1) By User-defined functions
2) Using an In-built function
3) Using temporary string

Link:
C++ Program to reverse a string: https://www.geeksforgeeks.org/reverse-a-string-in-c-cpp-different-methods/ 
C++ Program to reverse a string using iterative & recursive approach: https://www.geeksforgeeks.org/program-reverse-string-iterative-recursive/