title: How to read exactly 4 char in c ..?
body: <p>I want to read exactly 4 chars from the console for this I'm doing this, but it is not working as I expect it to, it reads more &amp; less chars ..</p>
  
  <pre><code>    int main()
  {
      char arr[4];
      scanf("%s",&amp;arr);
      printf("%s",arr);
      return 0;
  }
  </code></pre>
  
  <p>My Input to this program is this: </p>
  
  <pre><code>sachinjainsachin
  sachinjainsachin
  </code></pre>
  
  <p>It prints the whole the char array while the size of array is <code>4</code>. I don't know why it is printing more than the size, it should to print only 4 chars i.e. <strong>sachi</strong></p>