title: Is it safe to cast size_t to unsigned long int?
body: <p>I need a portable way to print the value of a variable <em>n</em> of type <code>size_t</code>. Since I use ANSI C89 I cannot use the <code>z</code> length modifier. My current approach is to cast the value to <code>long unsigned int</code>:</p>
  
  <pre><code>printf("%lu\n", (long unsigned int) n);
  </code></pre>
  
  <p>Provided that <code>size_t</code> is defined as either <code>unsigned int</code> or <code>long unsigned int</code> I can't see how this would fail. Is the cast safe?</p>