title: C how to allocate struct to struct?
body: <p>The following code gives me a Compile error "<code>incompatible types at assignment</code>"</p>
  
  <p>File 1:</p>
  
  <pre><code>struct x{ 
    int a; 
    int b; 
    int c;
  };
  </code></pre>
  
  <p>File 2:</p>
  
  <pre><code>static struct x d;
  void copyStructVal(){
    d-&gt; a = 1;
    d-&gt; b = 2;
    d-&gt; c = 3;
  }
  x getStruct(){
   copyStructVal();
   return d;
  }
  </code></pre>
  
  <p>File 3:</p>
  
  <pre><code>static struct x e;
  void copy(){
   e = getStruct();
  }
  </code></pre>
  
  <p>I've searched for this and can't find the answer. Can I do it with a Pointer? (I'm a amateur in C)</p>