title: Creating Struct node on c++
body: <p>I having some doubt with struct.</p>
  
  <pre><code>  struct node
      {
          int data;
          node* next;
      }node; &lt;---- what does this actually do? 
  </code></pre>
  
  <p>Thanks.</p>
  
  <p>add on::</p>
  
  <p>Hi, trying to fix this error..</p>
  
  <p>Line 11: error: expected constructor, destructor, or type conversion before '*' token
  compilation terminated due to -Wfatal-errors.   </p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  struct node
  {
      int data;
      node* next;
  }node;
  
  node* nodeNew(int newData, node* newNext) // line 11
  {
      node* n= new node;
      n-&gt;data= newData;
      n-&gt;next= newNext;
      return n;
  }
  
  void listPrint(node* p)
  {
      while( p!=NULL )
      {
          cout &lt;&lt; p-&gt;data &lt;&lt; " "; p= p-&gt;next;
      }
  }
  
  int main()
  {
  
  
  }
  </code></pre>
  
  <p>Is happens when i add that "node" in the struct.</p>