title: Revisiting the array of strings initialization in C
body: <p>I want to initialize in plain <code>C</code> an array of strings with the following requirements:</p>
  
  <p>(A) I need the strings in a header file, since some other modules are using them as plain strings, so I declared in the header file:</p>
  
  <pre><code>extern const char* const ERRMSG_VM_0001;
  extern const char* const ERRMSG_VM_0002;
  extern const char* const ERRMSG_VM_0003;
  extern const char* const ERRMSG_VM_0004;
  </code></pre>
  
  <p>and in the source file:</p>
  
  <pre><code>const char* const ERRMSG_VM_0001 = "[VM-001] some text ";
  const char* const ERRMSG_VM_0002 = "[VM-002] more text ";
  const char* const ERRMSG_VM_0003 = "[VM-003] other text ";
  const char* const ERRMSG_VM_0004 = "[VM-003] and even more";
  </code></pre>
  
  <p>(B) I need these strings also in an array, so I tried in the (same) source (as above):</p>
  
  <pre><code>static const char* error_table[4] =
  {
      ERRMSG_VM_0001,
      ERRMSG_VM_0002,
      ERRMSG_VM_0003,
      ERRMSG_VM_0004
  };
  </code></pre>
  
  <p>Obviously, the compiler complains <code>error: initializer element is not constant</code> ... so now I am wondering how can I achieve this in a pure <code>C</code> way, not <code>C++</code> (this is similar to <a href="https://stackoverflow.com/questions/8100470/tricky-array-initialization">Tricky array Initialization</a> but it's not the same). </p>