Hi All,
Im trying to write a little programe that checks if a word entered is a palendrome or not.
The programe runs but gives in-correct results, im realy stumped as to whats up, I wondered if any one could point me in the right direction.
Many thanks
Colin
Code:#include<stdio.h> #include<string.h> void main() { char mystring[20],compstring[20]; int length,loop,index=0; printf("Please enter a word under 20 letters to test : "); gets(mystring); length = strlen(mystring)-1; for(loop=length;length>0;length--) { compstring[index] = mystring[loop]; index++; } if(!strcmp(mystring,compstring)) { printf("The string Is A Palendrome"); } else { printf("The string Is NOT A Palendrome"); } }