title: Declaring Pascal-style strings in C
body: <p>In C, is there a good way to define length first, Pascal-style strings as constants, so they can be placed in ROM? (I'm working with a small embedded system with a non-GCC ANSI C compiler).</p>
  
  <p>A C-string is <code>0</code> terminated, eg. {<code>'f'</code>,<code>'o'</code>,<code>'o'</code>,<code>0</code>}.</p>
  
  <p>A Pascal-string has the length in the first byte, eg. {<code>3</code>,<code>'f'</code>,<code>'o'</code>,<code>'o'</code>}.</p>
  
  <p>I can declare a C-string to be placed in ROM with:</p>
  
  <pre><code>const char *s = "foo";
  </code></pre>
  
  <p>For a Pascal-string, I could manually specify the length:</p>
  
  <pre><code>const char s[] = {3, 'f', 'o', 'o'};
  </code></pre>
  
  <p>But, this is awkward. Is there a better way? Perhaps in the preprocessor?</p>