title: How to duplicate a structure into a pointer with malloc function [C-Programming]
body: <p>I've tried to create a function that duplicate a structure into a pointer, but here is the issue, there is a <code>char</code> tab into the structure and I can't assign my original value to the new structure. </p>
  
  <p>The function : </p>
  
  <pre><code>Planete *dupliquer(Planete *p){
    Planete *res;  
    res = (Planete*) malloc(sizeof(Planete));
    if(res == NULL){
      printf("Erreur d'allocation...\n");
      exit(1);
    }
    res-&gt;nomplanete = p-&gt;nomplanete;
    res-&gt;rayon = p-&gt;rayon;
  
    return res;
  }
  </code></pre>
  
  <p>And here is the compilator error :</p>
  
  <pre><code> error: incompatible types when assigning to type ‘char[20]’ from type ‘char *’
     res-&gt;nomplanete = p-&gt;nomplanete;
                     ^
  </code></pre>
  
  <p>Can you please help me, It will be very nice. Thanks for your support !</p>