0
Sentence palindrome
#include<stdio.h> #include<string.h> #include<ctype.h> int main() { char str1[100],str2[100]; gets(str1); for(int i=0;str1[i]!='\0';i++) { if(str1[i]>='A'&&str1[i]<='Z') tolower(str1[i]); } strcpy(str2,str1); strrev(str1); if(strcmp(str1,str2)==0) printf("Palindrome!"); else printf("Not a palindrome"); return 0; }//please someone find the problem.
1 Réponse
0
use str1 = strrev(str1); because strrev doesnt actually change the content, just return the reversed string. But its not in the c library so I may be talking about another strrev