title: Is argv[n] writable?
body: <p>C11 5.1.2.2.1/2 says:</p>
  
  <blockquote>
    <p>The parameters <code>argc</code> and <code>argv</code> and the strings pointed to by the <code>argv</code> array shall
    be modifiable by the program, and retain their last-stored values between program
    startup and program termination.</p>
  </blockquote>
  
  <p>My interpretation of this is that it specifies:</p>
  
  <pre><code>int main(int argc, char **argv)
  {
      if ( argv[0][0] )
          argv[0][0] = 'x';   // OK
  
      char *q;
      argv = &amp;q;              // OK
  }
  </code></pre>
  
  <p>however it does not say anything about:</p>
  
  <pre><code>int main(int argc, char **argv)
  {
      char buf[20];
      argv[0] = buf;
  }
  </code></pre>
  
  <p>Is <code>argv[0] = buf;</code> permitted?</p>
  
  <p>I can see (at least) two possible arguments:</p>
  
  <ul>
  <li>The above quote deliberately mentioned <code>argv</code> and <code>argv[x][y]</code> but not <code>argv[x]</code>, so the intent was that it is not modifiable</li>
  <li><code>argv</code> is a pointer to non-<code>const</code> objects, so by in the absence of specific wording to the contrary, we should assume they are modifiable objects.</li>
  </ul>