title: strcpy() with copying string from one structure to another
body: <p>it seems that this is a duplicate question, but I searched stackoverflow's question about that point and non is like to my problem(I think)</p>
  
  <p>I've two variables of a struct each has its own pointer to char, when I tried to copy from one variable's string to another variable's string, nothing happened, although no errors appear, just warning</p>
  
  <pre><code>implicit declaration of function strcpy
  incompatible implicit declaration of built-in function 'strcpy'
  </code></pre>
  
  <p>I read from some questions on stackoverflow that you'd better to use strdup() function instead of strcpy() but when I did, I had an error</p>
  
  <pre><code>too many arguments to function 'strdup'
  </code></pre>
  
  <p>I read that there's a problem with strcpy() called "segmentation fault" and I knew it's about memory allocation, I don't totally understand what it's exactly and don't know if it's the problem with my code?</p>
  
  <p>and this is  my code</p>
  
  <pre><code>struct p
  {
  char *name;
  struct p *next;
  };
  struct p *ptrary[10];
  
  int main(void)
  {
      struct p p,q;
      p.name="xyz";
      p.next=NULL;
      ptrary[0]=&amp;p;
  
      strdup(q.name,p.name);
      ptrary[1]=&amp;q;
  
      printf("%s\n",ptrary[1]-&gt;name);
  return 0;
  }
  </code></pre>
  
  <p>so what is the problem and how I can solve it?</p>