title: Implementation of strtok() function
body: <p>I need to write my function strtok. Below is my code. The problem is - I can't display result string. In code I use <code>strcpy()</code> and then display new array.
  Is it possible to display string using just pointer <code>*str</code>?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;   
  
  char* my_strtok(char* s, char* delm){
      char W[100];
      int i = 0, k = 0, j = 0;
      char *ptr;
      static char *Iterator;
      ptr = s;
  
      if (s == NULL){
          s = Iterator;
      }
      while (s[i] != '\0'){
          j = 0;
          while (delm[j] != '\0'){
              if (s[i] != delm[j])
                  W[k] = s[i];
              else goto It;
              j++;
          }
          ptr++;
          i++;
          k++;
      }
  It:
      W[i] = 0;
      Iterator = ++ptr;
      return W;
  }
  
  int main(void){
      char s[100];
      char delm[] = " ";
      gets(s);
      char newstr[100];
      char *str = my_strtok(s, delm);
      strcpy(newstr, str);
      printf("%s", newstr);
      return 0;
  }
  </code></pre>