title: Using size_t for specifying the precision of a string in C's printf
body: <p>
  I have a structure to represent strings in memory looking like this:</p>
  
  <pre class="lang-c prettyprint-override"><code>typedef struct {
      size_t l;
      char   *s;
  } str_t;
  </code></pre>
  
  <p>I believe using size_t makes sense for specifying the length of a char string. I'd also like to print this string using <code>printf("%.*s\n", str.l, str.s)</code>. However, the <code>*</code> precision expects an <code>int</code> argument, not <code>size_t</code>. I haven't been able to find anything relevant about this. Is there someway to use this structure correctly, without a cast to <code>int</code> in the <code>printf()</code> call?</p>