title: "assignment discards 'const' qualifier" error on non-const pointer
body: <p>In the following function:</p>
  
  <pre><code>char *mystrtok(const char *input, const char *delim,char *rest) {
      int i;
      for (i = 0; input[i] != *delim &amp;&amp; input[i] != '\0'; ++i) {
          continue;
      }
      char *result = malloc(sizeof(char) * (i + 2));
      memcpy(result, input, i + 1);
      result[i + 1] = '\0';
      if (input[i + 1] != '\0') 
          rest = input + i + 2;
      else
          rest = NULL;
      return result;
  }
  </code></pre>
  
  <p>I am getting <code>assignment discards 'const' qualifier from pointer target type</code> for the line <code>rest = input + i + 2</code>, however, as you can see, rest is not a constant pointer. What am I doing wrong here?</p>