Reverse a String C Program

By | August 5, 2016

C Program To Reverse a String

Learn How To Reverse a String in C Programming Language. We have described different versions of String Reversal Program in C Language.

strrev() method is defined in the string.h header file. It is therefore, a Library Function. strrev() method is used to reverse any given string. A String is primarily an Array of Characters.


If you want to input a Multi – word String from the user, you have to use the following scanf() method.

If you want to enter only a single word String, then you can use the following scanf() method.

Must Read: C Program To For String Reversal using Stack Data Structure


Method 1: C Program To Reverse a String using Library Function and Array

C Program To Reverse a String without String Function strrev() and For Loop

Must Read: C Program To Sort Name String in Alphabetical Order


Output

C Program To Reverse a String using Library Function strrev and using Arrays with For Loops

If you have any compilation error or doubts in this C Program For String Reversal without String Functions, let us know about it in the Comment Section below.

4 thoughts on “Reverse a String C Program

  1. Vighnesh Patil

    Thanks for so easy methods of reversing a string. Can we use reverse a string using Pointers in C?

    Reply
    1. Pavneet Singh

      Yes! Definitely! We can use Pointers in Strings! In fact, many methods of manipulation in string uses pointers!

      Reply
  2. Jai Bhagwat

    What is better? Reversing a String using Arrays or Reverse a String Array using Stack Data Structure. However, this C program seems more easy in implementation.

    Reply
    1. Tushar Soni Post author

      Stack is also an implementation of array. I would suggest you to understand the logic in both the C Programs To Reverse a String. Even if you know one method, it would be more than enough.

      Reply

Let's Discuss