title: Why does printf("%d\n", printf("%d\b", a)) work this way?
body: <p>This is my C code, compiled with gcc.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  
  int main() 
  { 
      int a=1; 
      switch(a)
      {
         int x=10;
         case 1:
             printf("%d\n",printf("%d\b",x));
             break;
         default:
             printf("%d\n",printf("%d\b",x));
      }
      return 0;
  }
  </code></pre>
  
  <p>printf() is supposed to return the number of elements it printed successfully.
  <code>printf("%d\b", x)</code> should have printed 10 by itself(since the \b takes the printing pointer one step behind (to the digit 0 in 10) and there is nothing to print after that.
  So it should have just printed 10. That is 2 characters. Now the outer printf would display 2.
  The output should have been 102.
  The output I actually see is 2.</p>
  
  <p>And in case of nested <code>printf</code>s is the printing pointer position remembered? I mean, if there is a <code>\b</code> in the inside <code>printf</code> , it would take the printing pointer one step behind. And when the control now goes to the outer <code>printf</code>, is that changed position remembered? Will it overwrite over that last character?</p>