fork(1) download
  1. # include <stdio.h>
  2.  
  3. int isPalindrome(char s[])
  4. {
  5. int i,j;
  6. char cs[100];
  7. while(s[i] != '\0')
  8. {
  9. i++;
  10. }
  11.  
  12. for(j = i; j = 0; j--)
  13. {
  14. cs[i-j-1] = s[j];
  15. }
  16.  
  17. while(cs[i] != '\0')
  18. {
  19. printf("%c/n",cs[i]);
  20. i++;
  21. }
  22.  
  23. for(i = 0; s[i]==cs[i] ; i++)
  24. {
  25. if(s[i]=='\0')
  26. {
  27. return 1;
  28. }
  29. }
  30. return 0;
  31. }
  32.  
  33. int main(){
  34. char s[100];
  35. scanf("%s",s);
  36. printf("%s -> %d\n",s,isPalindrome(s));
  37. return 0;
  38. }
  39.  
Success #stdin #stdout 0s 5320KB
stdin
girafarig
stdout
girafarig -> 0