Palindromes are words or phrases that read the same backwards as forwards....
as I notice on the previous forums, some effort has been expended on this topic..
and I have some questions, which (I believe) would simplify everything.
it has to do with the source code below...(it is working)..
but what i can't discern is another function or tool that i may use
to store the "backwards string"..
in other words... I want to store the string that was read backwards on some char array, lets say "tmp"...
then later on I may compare it if it is a palindrome or not...
here it goes:
Code:
#include<stdio.h>
#include<string.h>
main()
{
char str[80];
int i;
clrscr();
printf("enter string: ");
gets(str);
for(i=strlen(str)-1; i>=0; i--)
printf("%c", str[i]);
getch();
}
------
notice that each true statement in the for loop prints a character backwards...
but what I really want is to store all those characters(now backwards),......
and then "printf" them all at once ... [not one by one]..
Any ideas or codes to share ?? I'll take note of it !!
Thank You !!