title: How do I tokenize a char array to different int in C?
body: <p>I'm not familiar with <code>C</code> and I'm getting frustrated. I need to create 3 <code>int</code> variables from the <code>char</code> array token. This is supposed to be a date mm/dd/yyyy. My 3 <code>int</code> variables would be:</p>
  <pre><code>int monthNum; 
  int dayNum;  
  int yearNum;
  </code></pre>
  <pre><code>void handlePrint() { 
    char token[MAX_COMMAND_TOKEN_LENGTH]; // Placeholder for the first argument
    int weekDays = 7;
    int numDays = 31;
  
    if (getCommandWord(token, MAX_COMMAND_TOKEN_LENGTH) != '\n') {
      printf(&quot;Too many arguments for print command! It must be in the form of print MM/DD/YYYY.\n&quot;);
      while (getCommandWord(token, MAX_COMMAND_TOKEN_LENGTH) != '\n');
      return;
    }
    printf(&quot;printing the weeks of month %s\n\n&quot;, token);
  }
  </code></pre>
  <p>I tried to tokenize the token by doing the following:</p>
  <pre><code>char* endPoint = &quot;/&quot;;
  long int monthN = strtol (token, &amp;endPoint, 10);
  </code></pre>
  <p>which gets the first variable, how can I create the two other variables?</p>
  <p>I would really appreciate your help!</p>