Given a string, the task is to reverse this String using pointers.
Input: Geeks Output: skeeG Input: GeeksForGeeks Output: skeeGroFskeeG
Approach: This method involves taking two pointers, one that points at the start of the string and the other at the end of the string. The characters are then reversed one by one with the help of these two pointers.
Enter a string: GeeksForGeeks Reverse of the string: skeeGroFskeeG
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Program to reverse an array using pointers
- C++ Program to compare two string using pointers
- C program to sort an array using pointers
- The length of a string using pointers
- Why C treats array parameters as pointers?
- What are Wild Pointers? How can we avoid?
- Introduction of Smart Pointers in C++ and It's Types
- Dangling, Void , Null and Wild Pointers
- Pointers in C and C++ | Set 1 (Introduction, Arithmetic and Array)
- Pointers in C/C++ with Examples
- Pointers vs References in C++
- What are near, far and huge pointers?
- Applications of Pointers in C/C++
- Difference between pointer to an array and array of pointers
- Features and Use of Pointers in C/C++
- Pointers and References in C++
- Difference between Iterators and Pointers in C/C++ with Examples
- Chain of Pointers in C with Examples
- How many levels of pointers can we have in C/C++
- Why do we need reference variables if we have pointers
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.