title: C++ Struct creation error does not name a type
body: <p>When I run my program, following error occurs each time when I use <code>temp-&gt;</code>. </p>
  
  <p>[Error] request for member 'key' in '* temp', which is of pointer type 'NodeType {aka Node*}' (maybe you meant to use '->' ?)</p>
  
  <p>What is wrong with the code.</p>
  
  <pre><code>struct Node;
  typedef Node *NodeType;
  
  int NumNodes = 0;
  const int SIZE = 100;
  NodeType data[SIZE];
  
  
  struct Node{
  int key;
  NodeType *left, *right;
  };
  
  NodeType *newNode(int value){
    if(NumNodes == SIZE)
      cout &lt;&lt; "This Node Pool is full." &lt;&lt; endl;
      exit(1);
  
    NodeType *temp = &amp;data[NumNodes++];
    temp-&gt;key  = value;                  
    temp-&gt;left = temp-&gt;right = NULL;     
    return temp;
  }
  </code></pre>