title: Printing char array in C causes segmentation fault
body: <p>I did a lot of searching around for this, couldn't find any question with the same exact issue.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>void fun(char* name){
      printf("%s",name);
  }
  
  char name[6];
  sscanf(input,"RECTANGLE_SEARCH(%6[A-Za-z0-9])",name)
  printf("%s",name);
  fun(name);
  </code></pre>
  
  <p>The name is grabbed from <code>scanf</code>, and it printed out fine at first. Then when <code>fun</code> is called, there is a segmentation fault when it tries to print out name. Why is this?</p>