title: gcc pointer error did you mean to use ‘->’?
body: <p>I have defined structs in header file</p>
  
  <pre><code>typedef struct tDLElem {                 
          int data;                 
          struct tDLElem *lptr;     
          struct tDLElem *rptr; 
  } *tDLElemPtr;
  
  typedef struct { 
      tDLElemPtr First;
      tDLElemPtr Act; 
      tDLElemPtr Last;
  } tDLList;
  </code></pre>
  
  <p>And I have this code</p>
  
  <pre><code>void DLInsertFirst (tDLList *L, int val) {
      tDLElemPtr *newPtr = (tDLElemPtr *) malloc(sizeof(struct tDLElem));
      if (newPtr == NULL)
          DLError();
      newPtr-&gt;lptr = NULL;
      newPtr-&gt;rptr = L-&gt;First;
      newPtr-&gt;data = val;
      if (L-&gt;First != NULL)
      {
          L-&gt;First-&gt;lptr = newPtr;
      }
      else
      {
          L-&gt;Last = newPtr;
      }
      L-&gt;First = newPtr;
  }
  </code></pre>
  
  <p>It seems fine to me but when I try to build it, gcc says </p>
  
  <blockquote>
    <p>c206.c: In function ‘DLInsertFirst’: c206.c:104:8: error: ‘*newPtr’ is
    a pointer; did you mean to use ‘->’?   newPtr->lptr = NULL;</p>
    
    <p>c206.c:109:18: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]    L->First->lptr = newPtr;</p>
  </blockquote>
  
  <p>Can you tell me where is my code wrong ? And mostly why is it telling me to use '->' when I use it there ? Thanks</p>