title: Recursive addition code in C
body: <p>The following code works but I don't quite understand how <strong>*if (<em>s == 0)</em></strong> works.
  It checks if the string is 0?</p>
  
  <p>Also for <strong><em>return(isnumber(s+1))</em></strong> what is the logic behind that? 
  I know s is a string but I can just pass s+1 into a function? How does it even know what character I'm looking for?</p>
  
  <pre><code>int isnumber(char *s) {
      if (*s == 0) {
          return 1;  /* Reached end, we've only seen digits so far! */
      }
      if(!isdigit(*s)) {
          printf("The number is invalid\n");
          return 0;  /* first character is not a digit, so no go */
      }
      return(isnumber(s+1));
  }
  
  
  int main () {
      char inbuf[LENGTH];
      int i, j;
  
      printf("Enter a string &gt; ");
      fgets(inbuf, LENGTH-1, stdin); // ignore carriage return
      inbuf[strlen(inbuf)-1] = 0;
      j = isnumber(inbuf);
  ....
  }
  </code></pre>