
| Turbo C - Word in Reverse Order |
|
#include<stdio.h> #include<string.h> /* Programmed by Harvey Losin */ /* http://www.bikoy.com/harvey */ /* webmaster@bikoy.com */ main() { char str[30]; int x, y; clrscr(); printf("n Enter string: "); gets(str); /* input string */ y=strlen(str); /* determine length of string */ for(x=y-1; x>=0; x--) /* fetches and prints the elements of the string in reverse order */ { printf("%c", str[x]); } getch(); }
|