This strrev() string function reverses a given string.
Syntax for strrev()
1 |
strrev(String_name); |
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
/* -------------------------------- Works only on Visual C compiler --------------------------------*/ #include<stdio.h> #include<string.h> #include<ctype.h> int main() { char s1[]="hello"; char s2[20]; printf ( "Before reverse = %s\n", s1 ) ; strrev(s1); printf ( "After reverse = %s", s1 ) ; } |
Output:
1 2 |
Before reverse = hello After reverse = olleh |