title: strtok - char array versus char pointer
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2529834/strtok-wont-accept-char-str">strtok wont accept: char *str</a>  </p>
  </blockquote>
  
  
  
  <p>When using the <code>strtok</code> function, using a <code>char *</code> instead of a <code>char []</code> results in a segmentation fault.</p>
  
  <p>This runs properly:</p>
  
  <pre><code>char string[] = "hello world";
  char *result = strtok(string, " ");
  </code></pre>
  
  <p>This causes a segmentation fault:</p>
  
  <pre><code>char *string = "hello world";
  char *result = strtok(string, " ");
  </code></pre>
  
  <p>Can anyone explain what causes this difference in behaviour?</p>