title: Maximum characters printable by printf in C
body: <p>In C's printf function in using this gigantic string formatter width sub-specifier; close to the standard's limit a positive signed int; which is provided below the rest of the string formats are ignored.</p>
  
  <p>Example String format:</p>
  
  <pre><code>printf("**%2147483614p %1073739618p This text and %d formatters are ignored!!! why**", &amp;i, &amp;j, 10);
  </code></pre>
  
  <p>output:
  **<code>2147483614 empty spaces</code>0xbf****** <code>1073739618 empty spaces</code></p>
  
  <p>Problem:</p>
  
  <p>The text "**This text and 10 formatters are ignored!!! why****" and the integer 10 does not show up on screen.
  It prints the full of the first %p with its padding and the padding created by the width specifier for the second %p but no pointer and rest of string to be printed.</p>
  
  <p>Note: the second pointer can be made to be printed by left adjusting the format specifier like</p>
  
  <p><strong>printf("</strong>%-2147483614p %-1073739618p This text and %d formatters are ignored!!! why**", &amp;i, &amp;j, 10);** </p>
  
  <p>but still the strings after are still missing.</p>
  
  <p>The code</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main(int argc, char const *argv[]){
      printf(argv[1]);
      return 0;
  }
  </code></pre>
  
  <p>x86_64-linux-gnu
  gcc version 7.3.0</p>
  
  <p>gcc printf.c -o printf</p>
  
  <p>./printf "<strong>%-2147483614p %-1073739618p This text and %d formatters are ignored!!! why</strong>"</p>
  
  <p>P.S. I am aware this is a memory leak</p>
  
  <hr>
  
  <p>Found out %29p (29 is the max, 30 would not print) for second pointer prints the rest of the string. but if there is another format sting in the rest of the string it stops there.</p>