title: Casting Warning in C : assignment makes integer from pointer without a cast
body: <p>I am trying to take input from a user and I don't the exact length of input so therefore I am using malloc and I am splitting char by space between them and just need to print an array but I am getting warning i.e assignment makes integer from pointer without a cast on the following line:</p>
  
  <pre><code>array[i++] = p;
  </code></pre>
  
  <p>and my whole program is as follows:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main ()
  {
    char buf[] ="abc qwe ccd";
    int i;
    char *p;
    char *array=malloc(sizeof(char));
    i = 0;
    p = strtok (buf," ");
    while (p != NULL)
    {
      array[i++] = p;
      p = strtok (NULL, " ");
    }
    for (i=0;i&lt;3; ++i)
      printf("%s\n", array[i]);
    return 0;
  }
  </code></pre>
  
  <p>Can anyone please tell me what is wrong with my code.
  Thank you.</p>