title: Expression must have pointer-to-struct-or-union type?
body: <p>Working with a linked list to extract data from the head of the list. The data is already set within the Head, but when I try to access it I get that error. Think there is an issue with pointers but I cannot work it out. </p>
  
  <pre><code>int main(int argc, char **argv)
  {
      int i;
  
      struct timeval start, end;
      struct element *Head = NULL;
      struct element *Tail = NULL;
  
      //creating job queue
      for (i = 0; i &lt; NUMBER_OF_JOBS; i++) {
          addLast(generateProcess(), &amp;Head, &amp;Tail);
      }
  
      //go through job queue running processes and removing processes
      while (Head) {
          runPreemptiveJob(Head-&gt;pData, &amp;start, &amp;end);
  
          int responseTime = getDifferenceInMilliSeconds(Head-&gt;pData-&gt;oTimeCreated, start);
  
          printf("Response Time is: %d\n", responseTime);
  
          Head = Head-&gt;pNext;
      }
  }
  </code></pre>
  
  <p>I am expecting to be able to use the data in oTimeCreated by accessing it through the head element, which has a structure in its data field.</p>
  
  <p>The error is when calling the getDifferenceInMilliSeconds function: I get an error on the Head which says "Expression must have pointer-to-struct-or-union type. </p>
  
  <p>Element is shown here:</p>
  
  <pre><code>struct element
  {
      void * pData;
      struct element * pNext;
  };
  </code></pre>
  
  <p>generateProcess() returns a struct process, as defined below:</p>
  
  <pre><code>struct process
  {
      int iProcessId;
      struct timeval oTimeCreated;
      struct timeval oMostRecentTime; 
      int iInitialBurstTime;
      int iPreviousBurstTime;
      int iRemainingBurstTime;
      int iPriority;
  };
  </code></pre>
  
  <p>In the main function, generateProcess() returns a pointer to a process. This pointer is put into the linked list, and so I am trying to access the oTimeCreated variable which is part of that struct which is the head of the list. </p>