title: How does strchr implementation work
body: <p>I tried to write my own implementation of the strchr() method.</p>
  
  <p>It now looks like this:</p>
  
  <pre><code>char *mystrchr(const char *s, int c) {
      while (*s != (char) c) {
          if (!*s++) {
              return NULL;
          }
      }
      return (char *)s;
  }
  </code></pre>
  
  <p>The last line originally was </p>
  
  <pre><code>return s;
  </code></pre>
  
  <p>But this didn't work because s is const. I found out that there needs to be this cast (char *), but I honestly don't know what I am doing there :( Can someone explain?</p>