strrev() function in C Programming Language
Table of Content:
strrev() function reverses a given string in C language. Syntax for strrev( ) function is given below.
Syntax
char *strrev(char *string);
Important Note
strrev()
function is non standard function which may not available in standard library in C.
Program
In below program, string Welcome to atnyla is reversed using strrev( ) function and output is displayed as alynta ot emocleW.
#include #include int main() { char name[30] = "Welcome to atnyla"; printf("String before strrev( ) : %s\n",name); printf("String after strrev( ) : %s \n",strrev(name)); return 0; }
Output
String before strrev( ) : Welcome to atnyla String after strrev( ) : alynta ot emocleW Press any key to continue . . .