title: C recursive function palindrome
body: <p>I'm trying to do a recursive function with C to check if a word is a palindrome or not (read in both ways).</p>
  
  <p>It's the first time I use this kind of function, but I have a problem, I don't know why it doesn't work, if you could help me, there's my code, thanks :</p>
  
  <pre><code>#include &lt;stdio.h&gt; 
  #include &lt;string.h&gt;
  
  int palindrome(char c[100],int i, int j)
  {
      if (j == i)
      {
          return 1;
      }
  
      // Si le premier et le dernier caractère
      // sont les mêmes alors, on peut commencer les tests
      if(c[i] == c[j])
      {
          // On fais les tests pour chaque caractère de la chaine
          return palindrome(c, i++, j--);
      } else {
          return 0;
      }
  
      return 0;
  }
  
  int main(void)
  {
      char chaine[100] = "radar";
      int pal;
  
      pal = palindrome(chaine, 0, strlen(chaine)); // Returns : 0 -&gt; False / 1 -&gt; True
      printf("%d", pal);
      return 0;
  }
  </code></pre>