C strrev()

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

snippet
#include
#include   
int main(){  
  char str[20];  
  printf("Enter string: ");  
  gets(str);//reads string from console  
  printf("String is: %s",str);  
  printf("\nReverse String is: %s",strrev(str));  
 return 0;  
}

Output:

Output
Enter string: javatpoint String is: javatpoint Reverse String is: tnioptavaj
Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents