title: How to use "zd" specifier with `printf()`?
body: <p>Looking for clarification on using <code>&quot;zd&quot;</code> with <code>printf()</code>.</p>
  <p>Certainly the following is correct with C99 and later.</p>
  <pre><code>void print_size(size_t sz) {
    printf(&quot;%zu\n&quot;, sz);
  }
  </code></pre>
  <p>The C spec <em>seems</em> to allow <code>printf(&quot;%zd\n&quot;, sz)</code> depending on how it is read:</p>
  <p>7.21.6.1 The <code>fprintf</code> function</p>
  <blockquote>
  <p><code>z</code> Specifies that a following <code>d</code>, <code>i</code>, <code>o</code>, <code>u</code>, <code>x</code>, or <code>X</code> conversion specifier applies to a <code>size_t</code> or the corresponding signed integer type argument; or that a following <code>n</code> conversion specifier applies to a pointer to a signed integer type corresponding to <code>size_t</code> argument.  C11dr §7.21.6.1 7</p>
  </blockquote>
  <p>Should this be read as</p>
  <ol>
  <li>&quot;<code>z</code> Specifies that a following <code>d</code> ... conversion specifier applies to a <code>size_t</code> or the corresponding signed integer type argument ... &quot;(both types) and &quot;<code>z</code> Specifies that a following <code>u</code> ... conversion specifier applies to a <code>size_t</code> or the corresponding signed integer type argument ...&quot; (both types)</li>
  </ol>
  <p>OR</p>
  <ol start="2">
  <li>&quot;<code>z</code> Specifies that a following <code>d</code> ... conversion specifier applies to a corresponding signed integer type argument ...&quot; (signed type only) and &quot;<code>z</code> Specifies that a following <code>u</code> ... conversion specifier applies to a <code>size_t</code>&quot; (unsigned type only).</li>
  </ol>
  <p>I've been using the #2 definition, but now not so sure.</p>
  <blockquote>
  <p>Which is correct, 1, 2, or something else?</p>
  <p>If #2 is correct, what is an example of a type that can use <code>&quot;%zd&quot;</code>?</p>
  </blockquote>