title: Array of C strings, initialized with string literals
body: <p>The <a href="http://www.ghostscript.com/doc/current/API.htm" rel="nofollow noreferrer">Ghostscript interpreter API</a> has a function</p>
  
  <pre><code>GSDLLEXPORT int GSDLLAPI gsapi_init_with_args(void *instance, int argc, char **argv)
  </code></pre>
  
  <p>The final argument <code>argv</code> is a pointer to an array of C strings, which are interpreted as command-line arguments. I obviously cannot change the signature of the function <code>gsapi_init_with_args</code> to take a <code>const char **</code> argument instead.</p>
  
  <p>If I were willing to ignore (or silence) the <code>deprecated conversion from string constant to 'char*'</code> warning, then I would write simply</p>
  
  <pre><code>char *gs_argv[] = {"", "-dNOPAUSE", "-dBATCH", ...};
  </code></pre>
  
  <p>and pass <code>gs_argv</code> as the final argument. But I would prefer to fix my code so that I am not relying on an external function to behave in the way I expect it to (and effectively treat <code>gs_argv</code> as <code>const char**</code>).</p>
  
  <p>Is there any simple way to declare <code>gs_argv</code> as an array of pointers to (non-<code>const</code>) C strings, and initialize its elements with string literals? (That is, using a similar approach to how I can initialize a single C string: using <code>char c_str[] = "abc"</code>.) The best I can think of is to use</p>
  
  <pre><code>const char *gs_argv0[] = {"", "-dNOPAUSE", "-dBATCH", ...};
  </code></pre>
  
  <p>and then copy the contents, element by element, into <code>gs_argv</code>.</p>
  
  <hr>
  
  <p>Please note that I understand why the compiler gives this warning (and have read the answers to, among others, <a href="https://stackoverflow.com/questions/14896329/warning-converting-from-string-const-to-char-in-initalizing-array-of-c-strings">this question</a>). I am asking for a solution, rather than an explanation.</p>