title: What is %*d in c?
body: <p>I have come across a code:</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  int main(){
      int n=5;
      printf("\nn=%*d",n,n);
      return 0;
  }
  </code></pre>
  
  <p>It outputs : <code>n= 5</code>. I know that <code>%*d</code> allows two parameters and returns the field width. However, I tried changing <code>n</code>'s value to <code>9</code>. But the output came in the same format (i.e. <code>n= 9</code>). Also , I am not 100% sure that I understand <code>%*d</code> and field width correctly.</p>
  
  <p>Hence my question, what is <code>%*d</code> and field width in C.</p>
  
  <p>Thanks.</p>
  
  <h2>EDIT:</h2>
  
  <p>Ok, thanks everybody. I now have understood that it was my compiler which was combining spaces into one. </p>