title: Invalid initializer error with struct
body: <p>I have two structures one is basic, position_3d. The other one is ray. </p>
  
  <pre><code>typedef struct{
  float x,y,z;    
  } position_3d;
  
  typedef struct{
  vector_3d direction;
  position_3d startPosition;  
  } ray;
  </code></pre>
  
  <p>I have implemented a function which return a position_3d struct</p>
  
  <pre><code>position_3d getIntersectionPosition(ray r, sphere s){
      position_3d pos; 
      //some code
  
      pos.x = r.startPosition.x + t*r.direction.x; 
      pos.y = r.startPosition.y + t*r.direction.y; 
      pos.z = r.startPosition.z + t*r.direction.z;  
      return pos; 
  }
  </code></pre>
  
  <p>when I call </p>
  
  <pre><code>position_3d pos = getIntersectionPosition(r, s);
  </code></pre>
  
  <p>I got this error invalid initializer. I am using gcc.
  The compilation command is gcc prog.c -o prog.out -lm -lGL -lGLU -lglut  </p>
  
  <p>I am really stuck now! May anybody help?</p>