title: C Struct Error: Stack Smashing Detected, Aborted (Core Dumped)
body: <p>Hi I am writing a simple C program using "struct".  I am trying to add strings (which always seems to be trouble) and I finally get to compile but when I run it I get an error.  The file name is "struct" this is the error:</p>
  
  <pre><code>*** stack smashing detected *** ./struct terminated
  Aborted (core dumped)
  </code></pre>
  
  <p>Here is the code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;stdlib.h&gt;
  
  
  struct members {
  
      int  id;
      int  age;
      char name[];
  };
  int main(void)
  {
      struct members person;
      person.id = 1223;
      person.age = 37;
      strcpy(person.name, "Matthew");
  
      printf("ID: %d\n Age: %d\n Name: %s\n", person.id, person.age, person.name);
  
  return 0;
  }
  </code></pre>
  
  <p>I have no idea why it's compiling fine then crashing.  I guess it's a memory problem with the code in relation to the string.  Funny thing is that it actually works and prints the info to console and then it crashes.  Any help is appreciated.  Thanks.</p>