title: assign a string to a structure variable in c
body: <pre><code>#include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  typedef struct t_name
  {
       char last_name[25];
       char first_name[15];
       char middle_init[2];
  } NAME;
  NAME my_name, your_name;
  int main()
  {
      char temp[] = "sumit";
      printf("Program started\n");
      my_name.first_name=temp;
      your_name = my_name;
      NAME abc=my_name;
      printf("my_name=%s\n",my_name.first_name);
      printf("your_name=%s\n",your_name.first_name);
      printf("abc=%s\n",abc.first_name);
  }
  </code></pre>
  
  <p>But error occurs in following statement <code>my_name.first_name=temp;</code></p>