You can use below C program to reversing a string. If you want to get input string from user, please use scanf and printf in below program.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
#include<stdio.h> #include<string.h> int main() { char name[30] = "Hello"; printf("String before strrev( ) : %s\n",name); printf("String after strrev( ) : %s",strrev(name)); return 0; } |
Output:
String before strrev( ) : Hello
String after strrev( ) : olleH