strrev in c

strrev() function in c

strrev(string) gives the reverse of the string. The string pass as argument in the strrev() function. strrev( ) function is non a standard function which may not available in standard library in C programming.

Syntax : strrev(string)

/* use of strrev() */
#include<stdio.h>
#include<string.h>
int
main()
{
char str[25];
printf("Enter the String to Reverse\n");
gets(str);
printf("Original string =%s \n",str);
printf("Reverse string =%s",strrev(str));
return 0;
}

output:
Enter the String to Reverse Rajesh kumar
Original string = Rajesh kumar
Reverse string =kumar Rajesh

/* use of strrev() */
#include<stdio.h>
#include<string.h>
int main()
{
char str[30];
printf("Please Enter String: ");
gets(str);//reads string from user input
printf("String is: %s",str);
printf("\nAfter Reverse String is: %s",strrev(str));
return 0;
}