title: "Abort trap: 6" error in C?
body: <p>I'm a beginner to C but I have this code running on xcode through gcc on terminal:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt; 
  int main(){
      char name[12] = "Roman Mirov"; 
      printf("My name is %s\n", name);
      name[8] = 'k'; 
      printf("My name is %s\n", name);
      char greeting[] = "hello"; 
      printf("%s %s\n", greeting, name);
      strcpy(greeting, "greetings, "); 
      printf("%s%s\n", greeting, name);
      return 0;
  }
  </code></pre>
  
  <p>And it outputs this: </p>
  
  <pre><code>My name is Roman Mirov
  My name is Roman Mikov
  hello Roman Mikov
  Abort trap: 6
  </code></pre>
  
  <p>My question exactly is, why it generates error instead of showing the last line as output "greetings, Roman Mikov"?</p>