- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Reverse a string using the pointer in C++
This article reverse a string using the pointer in C++ coding, First, it calculates the length of a pointer to string then run a for loop in decrement order to display the reverse string as follows;
Example
#include <string.h> #include <iostream> using namespace std; int main(){ char *str="ajaykumar"; cout<<"original string::"<<str; cout<<endl<<"String after reverse::"; for(int i=(strlen(str)-1);i>=0;i--){ cout<<str[i]; } return 0; }
This above program prints the to be supplied string “ajaykumar” in reverse order as follows.
Output
Original string::ajaykumar String after reverse::ramukyaja
- Related Articles
- C++ Program to count Vowels in a string using Pointer?
- How to reverse a String using C#?
- To count Vowels in a string using Pointer in C++ Program
- Reverse a string in C/C++ using Client Server model
- Reverse a string in C#
- Reverse a string in C/C++
- How to Reverse a String in PL/SQL using C++
- Reverse a String (Iterative) C++
- Reverse a String (Recursive) C++
- Reverse Words in a String in C++
- Write program to reverse a String without using reverse() method in Java?
- Reverse Vowels of a string in C++
- C# program to reverse a string
- Reverse words in a given String in C#
- Reverse Words in a String II in C++

Advertisements