title: Is there a way to count tokens in C?
body: <p>I'm using <code>strtok</code> to split a string into tokens. Does anyone know any function which actually counts the number of tokens?</p>
  
  <p>I have a command string and I need to split it and pass the arguments to <code>execve()</code> .</p>
  
  <p>Thanks!</p>
  
  <p><strong>Edit</strong></p>
  
  <p><code>execve</code> takes arguments as <code>char**</code>, so I need to allocate an array of pointers. I don't know how many to allocate without knowing how many tokens are there.</p>