title: "invalid application of ‘sizeof’ to incomplete type ‘graph_edge {aka struct Graph_Edge}’"
body: <p>I don't understand why I get this error I looked in other answers and I did everything right. In graph data I use "struct Graph_Edge" in "struct Graph_Node" before the definition of the struct Graph_Edge. And I use "struct Graph_Node" in "struct Graph_Edge". I'm not sure if this could be the cause and if it is I do not understand why.</p>
  
  <p>Graph data:</p>
  
  <pre><code>#ifndef Graph_Structure
  #define Graph_Structure
  
  #include &lt;stdbool.h&gt;
  
  struct Graph_Node{
  
      int id;
      char node_name[100];
  
      //bool path;
  
      struct Graph_Node* next;
      struct Graph_Edge* edge;
  
      //struct Graph_Node* next_edge;
  
      };
  
  struct Graph_Egde{
  
      int src;
      int dst;
  
      bool path;
  
      struct Graph_Edge* next;
      struct Graph_Node* node; 
  
  };  
  
  typedef struct Graph_Node graph_node;
  typedef struct Graph_Edge graph_edge;
  
  
  #endif  
  </code></pre>
  
  <p>insert method:</p>
  
  <pre><code>#include "graph.h"
  
  ...
  
  void insert_edge(graph_edge** edge, graph_node* node, int src, int dst){
  
      graph_edge* temp = (graph_edge*)malloc(sizeof(graph_edge)); // the error is here
  
      temp-&gt;src = src; 
      temp-&gt;dst = dst;
  
      temp-&gt;node = node;
  
      temp-&gt;path = false; 
  
      temp-&gt;next = *edge;
      *edge = temp;
  }
  </code></pre>
  
  <p>I get this kind of error inside insert_edge method in the malloc line.</p>