title: How to use memcpy in Struct in c?
body: <p>I have a struct:</p>
  
  <pre><code>struct points{
  int i;
  int x;
  int y;
  };
  </code></pre>
  
  <p>I made an array of the struct and named it temp. Then I made another and named it pt. Suppose I put some contents to temp. How can I copy the elements of temp to pt?</p>
  
  <p>Here's my code of memcpy and the compiler says it's segmentation fault. Help please.</p>
  
  <pre><code>#define MAX_POINTS 400
  struct points temp[MAX_POINTS];
  /* Some code to input elements to array temp */
  struct points pt[i]; /* array of struct with i elements*/
  memcpy(&amp;pt, &amp;temp, sizeof (temp));
  </code></pre>