title: Im not sure how to use strtok to separate tokens
body: <p>I am messing around with C and want to try and do the following. so a User enters a date in the following format</p>
  <pre><code>Saturday, July 8, 2017, 22:14:10
  </code></pre>
  <p>and  I want to Use strtok to separate tokens and display output as follows,</p>
  <pre><code>Month: July
  Day: 8
  Year: 2017
  Hour: 22
  Minute: 14
  Second: 10
  </code></pre>
  <p>I have this so far:</p>
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  //&quot;Saturday, July 8, 2017, 22:14:10&quot;
  
  int main(void) {
      char date[6][20];
      char *order[] = {&quot;Month&quot;, &quot;Day&quot;, &quot;Year&quot;, &quot;Hour&quot;, &quot;Minute&quot;, &quot;Second&quot; };
      printf(&quot; Example: Saturday, July 8, 2017, 22:14:10 \n Enter date seperated by commas in following format: \n&quot;);
      char text;
      scanf(&quot; %s, &amp;text&quot;);
  
      char* delims = &quot; ,:&quot;;
      char* token = strtok(text,delims);
      char** label =  order;
      int r = 0;
      while (token){
  
          strcpy(date[r],token);
          printf(&quot;%-8s: %s\n &quot;,*label,date[r]);
      token = strtok(NULL,delims);
      label++;
      r++;
      }
      return 0;
  }
  </code></pre>
  <p>This is my output when I run the code</p>
  <p>Example: Saturday, July 8, 2017, 22:14:10
  Enter date seperated by commas in following format:
  Monday, August 1, 2012, 21:12:9</p>
  <p>Process finished with exit code -1073741819 (0xC0000005)</p>
  <p>What Am I doing wrong. Please help!</p>