title: passing command line argument in c as parameters
body: <p>I'm trying to make a function to assign a structure members a value.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  typedef struct 
  {
     int id;
     char *data;
  }person_t;
  
  person_t person_build(int id, char *data);
  
  
  int main (int argc, char *argv[])
  {
       person_t person = person_build(atoi(argv[1]), argv[2]);
       return 0;
  }
  
  person_t person_build(int id, char *data)
  {
      person_t person;
      person.id = id;
      strcpy(person.data, data);
  
      return person;
  }
  </code></pre>
  
  <p>This program compiled successfully.</p>
  
  <p>I run that program and give command line arguments as parameters
  to <code>person_build()</code> function as parameters.</p>
  
  <pre><code>&gt;struct5.exe 4 Something
  </code></pre>
  
  <p>operating system(windows 7) give me a warning <code>this program has stopped working</code></p>
  
  <p>but when run without any command line argument (changing the <code>person_build()</code> parameter other than command line arguments) that program works.</p>
  
  <p>can someone explain why this behaviour happen?</p>