Discussion Forums

New User? Please read instructions!

Need C program to reverse given string  

  RSS

thiyagarajan
Eminent Member
Joined:10 months  ago
Posts: 26
27/01/2017 9:36 am  

Need C program to reverse given string


ReplyQuote
admin
Eminent Member Admin
Joined:5 years  ago
Posts: 26
31/01/2017 11:44 am  

Hi Thiyagarajan, You can use below C program for reversing a string. If you want to get input string from user, please use scanf and printf in below program.

 

#include<stdio.h>

#include<string.h>

int main()

{

   char name[30] = "Hello";

   printf("String before strrev( ) : %s\n",name);

   printf("String after strrev( )  : %s",strrev(name));

   return 0;

}

Output:

String before strrev( ) : Hello

String after strrev( ) : olleH


ReplyQuote
  
Working

Please Login or Register






Share this website !!!
Facebook Twitter Linkedin