title: scanf not to exceed buffer overrun
body: <p>I have a buffer and I don't want the user to enter more characters than the buffer can hold (to avoid a buffer overrun).</p>
  
  <p>I am using <code>scanf</code> and have done like this:</p>
  
  <pre><code>char buffer[30] = {'\0'};
  scanf("%30s", buffer);
  </code></pre>
  
  <p>However, I know I am protected if the user enters more than 30. However, if the user enters more than 30, will the buffer be null terminated?</p>