title: How to arrange comma separated string in Arrays of String in c?
body: <p>I'm writing a <code>C</code> program which will parse comma separated string in Arrays of String.</p>
  
  <p>I have already tried a source code which prints the comma separated string. But I want those strings to be stored in an array of string. The following code uses <code>strcspn</code> and uses this following line</p>
  
  <pre><code>printf("%.*s\n", (int)field_len, s);
  </code></pre>
  
  <p>to print the strings which I am not able to understand. How can I transfer the printed string in the arrays of string?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  char ArrayOfString[10][5];
  
  void vSeparateSringByComma(char* string)
    {
      const char delims[] = ",";
      const char *s = string;
      int i = 0, j;
      do 
        {
          size_t field_len = strcspn(s, delims);
          printf("%.*s\n", (int)field_len, s);
          s += field_len;
          i++;
        } 
  
      while (*s++);   
     }
  
  int main() {
      char string[] = "$,0,3,307,183,18,5,119,1,#";
      vSeparateSringByComma(string);
  }
  </code></pre>
  
  <p>The output i am getting is</p>
  
  <pre><code>$
  0
  3
  307
  183
  18
  5
  119
  1
  #
  </code></pre>
  
  <p>(after every string there is a newline)
  which is perfectly fine. My problem is to transfer these strings to my array of strings.</p>
  
  <p>Any suggestions?</p>