title: Casting one C structure into another
body: <p>I have two identical (but differently named) C structures:</p>
  
  <pre><code>typedef struct {
        double x;
        double y;
        double z;
  } CMAcceleration;
  
  
  typedef struct {
      double x;
      double y;
      double z;   
  } Vector3d;
  </code></pre>
  
  <p>Now I want to assign a CMAcceleration variable to a Vector3d variable (copying the whole struct). How can I do this?</p>
  
  <p>I tried the following but get these compiler errors:</p>
  
  <pre><code>vector = acceleration;           // "incompatible type"
  vector = (Vector3d)acceleration; // "conversion to non-scalar type requested"
  </code></pre>
  
  <p>Of course I can resort to set all members individually:</p>
  
  <pre><code>vector.x = acceleration.x;
  vector.y = acceleration.y;
  vector.z = acceleration.z;
  </code></pre>
  
  <p>but that seems rather inconvenient.</p>
  
  <p>What's the best solution?</p>