title: C - use scanf to scan string into an array
body: <p>I am trying to make a program that uses one <em>scansf</em> function to get someones entire name at once and stores each letter in one layer of an array. 
  For example what it should do if the name entered is "tim":</p>
  
  <pre><code> array[0]=t
   array[1]=i
   array[2]=m
   array[3]=\0
  </code></pre>
  
  <p>i have read this in other threats but it doesn´t work:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main(void) {
      char array[256];
      scanf_s("%s", array);
      printf_s("%s", array);
      return 0;
  }
  </code></pre>
  
  <p>It gives out this error message:</p>
  
  <p><a href="https://i.stack.imgur.com/ubv96.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ubv96.png" alt="enter image description here"></a></p>
  
  <blockquote>
    <p>English:<br/>
    Exeption triggered at 0x0FAA0B5C <br/>
    access violation while writing position 0x01300000</p>
  </blockquote>
  
  <p>Is it even possible to use the <em>scanf</em> function if yes how?
  Or is there a better alternative?</p>
  
  <hr>
  
  <p>Thank you by adding the buffer parameter <strong>works</strong><br/>
  code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include "stdafx.h"
  
  int main(void) {
      char array[256];
      scanf_s("%255s", array, 256);
      printf("%s", array);
      return 0;
  }
  </code></pre>