Sentence palindrome | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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.

25th Sep 2018, 2:10 PM
Syed Naqvi
Syed Naqvi - avatar
1 Answer
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
25th Sep 2018, 2:39 PM
Bebida Roja
Bebida Roja - avatar