Search Your Topic

config
Thursday, 22 June 2017 03:15

C Reverse String: strrev()

Written by
Rate this item
(0 votes)

The strrev(string) function returns reverse of the given string. Let's see a simple example of strrev() function.

 
  1. #include<stdio.h>  
  2. #include<conio.h>  
  3. void main(){  
  4.   char str[20];  
  5.   clrscr();  
  6.   printf("Enter string: ");  
  7.   gets(str);//reads string from console  
  8.   printf("String is: %s",str);  
  9.   printf("\nReverse String is: %s",strrev(str));  
  10.   getch();  
  11. }    

Output:

Enter string: toshiyasit
String is: toshiyasit
Reverse String is: tisayihsot

 

Read 248 times
Anish Sir

"I am delighted once again to pen the welcome note to the Tosh!Yas Technologies ."

 Call +91 74 88 34 7779  | Email : anishsingh@live.com

toshiyas.in

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.