title: Linked list: Should the type of pointer "next" and the name of struct be same?
body: <pre><code>#include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  typedef struct {
      int val;
      struct node* next;
  } Node, *NodePtr;
  void makeInitialLinkedList(int a[], int n)
  {
      int i;
      NodePtr rec=NULL;
      NodePtr head=NULL;
      for (i=0; i&lt;n; i++) {
          NodePtr cur=(NodePtr)malloc(sizeof(Node));
          if (i==0) head=cur;
          if (rec!=NULL) rec-&gt;next=(node*)cur;
          cur-&gt;val=a[i];
          cur-&gt;next=NULL;
          rec=cur;
      }
  
      // test
      while(n--) {
          printf("%d ", head-&gt;val);
          head=(NodePtr)head-&gt;next;
      }
  }
  NodePtr copy(NodePtr head)
  {
      return NULL;
  }
  int main()
  {
      //Mission #2
      int initialDataArray[10]={5,3,2,8,9,7,0,6,4,1};
      makeInitialLinkedList(initialDataArray, 10);
  
  }
  </code></pre>
  
  <p>I do not understand why this works. I did not make a name initially for the struct and only made a surname "Node" by typedef. Then how does "struct node* next" work correctly? is node* a kind of data types like int* or char*? I thought like this:</p>
  
  <pre><code>typedef struct strName {
      int val;
      struct strName* next;
  } strSurName, *strPtr;
  </code></pre>
  
  <p>Does the type of pointer "next" and the initial name of struct have to same?</p>