fork download
  1. # include <stdio.h>
  2.  
  3. int isPalindrome(char s[]){
  4. int left=0, right, strlen=0;
  5. while(s[strlen]=='\0'){
  6. strlen++;
  7. }
  8. right=strlen-1;
  9. while(left<right){
  10. if(s[left]!=s[right]){
  11. return 0;
  12. }
  13. left++;
  14. right--;
  15. }
  16. return 1;
  17. }
  18.  
  19. int main(){
  20. char s[100];
  21. scanf("%s",s);
  22. printf("%s -> %d\n",s,isPalindrome(s));
  23. return 0;
  24. }
  25.  
Success #stdin #stdout 0.01s 5280KB
stdin
girafarig
stdout
girafarig -> 1