title: How do I fix these conflicting types error when passing linked list in C?
body: <p>I am very new to C and have not had much experience with linked lists. I am trying to create a disk scheduling program in FCFS and add the track requests to a queue (a linked list) for an assignment and am getting a plethora of warnings and a couple errors when trying to compile and I cannot figure out why. the errors I'm getting are on lines 86 and 101: <strong><em>conflicting types for 'AddToList' and 'RemoveFromList'.</em></strong> If someone could help me figure out what the issue is and how to fix it, it will be much appreciated. Thanks!</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;math.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;values.h&gt;
  #include &lt;time.h&gt;
  #include &lt;stdbool.h&gt;
  
  /* function declarations */
  int trackReqs(void);
  int numTrack(void);
  void AddToList(struct Queue_Struct *req_queue, int trackNum);
  int RemoveFromList(struct Queue_Struct *req_queue);
  
  // global variable declarations/initializations
  unsigned seed;
  int fileReqs;
  bool first = true;
  
  struct Queue_Node{
    int trackNumber;
    struct Queue_Node *next;
  };
  
  struct Queue_Struct{
    struct Queue_Node *q_head;
    struct Queue_Node *q_tail;
  };
  
  struct Queue_Struct fcfs;
  
  void main(){
    fcfs.q_head = NULL;
    fcfs.q_tail = NULL;
    printf("Seed for the random number generator: ");
    scanf("%d", &amp;seed);
    srand(seed);
    //printf("\n");
    printf("Number of file requests: ");
    scanf("%d", &amp;fileReqs);
    //printf("\n");
  
    // local variable declarations/initializations
    int totalReqs = 0;
    int numFileReqs = 0;
    float totalHeadMove = 0;
    int currTrack = 0;
    float diff;
    float average;
  
    do { // do this...
      int numTrackReqs = trackReqs(); // call function to get a random number between 1 and 5 to represent the number of track requests for the current file request
      for (int i = 0; i &lt; numTrackReqs; i++) { // for each track request for the current file request...
        int trackNum = numTrack(); // call function to get a random number between 0 and 799 to represent the number of the track requested
        AddToList(&amp;fcfs, trackNum); // call function to add the track request to the queue
        first = false;
      }
      int nextTrack = RemoveFromList(&amp;fcfs); // call function to remove the next (first) track request from the queue (signifying that the disk head will be moved to that track) and have that track returned
      diff = abs((float)nextTrack - (float)currTrack); // calculate the head movement for the current file request
      totalHeadMove += diff; // add the head movement for the current file request to the total head movement
      totalReqs++; // increase number of total requests by 1
      currTrack = nextTrack; // make the current track now the next track
      numFileReqs++; // increase number of file requests by 1
    } while(numFileReqs &lt;= fileReqs); // ...for each file request
    average = totalHeadMove / (float) numFileReqs; // calculate the average total head movement for each file request and print the result
    printf("Average head movement: %5.2f\n", average);
  }
  
  int trackReqs(void){
    int rand_num = (rand() % (5 - 1 + 1)) + 1; // generate random number from 1 to 5 representing number of track requests for the current file request
    return rand_num;
  }
  
  int numTrack(void){
    int rand_num = rand() % 800; // generate random number from 0 to 799 representing
    return rand_num;
  }
  
  void AddToList(struct Queue_Struct *req_queue, int trackNum){
    struct Queue_Node *newnode;
    newnode = (struct Queue_Node *) malloc(sizeof(struct Queue_Node));
    newnode-&gt;next = NULL;
    newnode-&gt;trackNumber = trackNum;
    if(req_queue-&gt;q_tail == NULL){
      req_queue-&gt;q_head = newnode;
      req_queue-&gt;q_tail = newnode;
      return;
    }
    req_queue-&gt;q_tail-&gt;next = newnode;
    req_queue-&gt;q_tail = newnode;
    return;
  }
  
  int RemoveFromList(struct Queue_Struct *req_queue){
    struct Queue_Node *loc;
    int first_req;
    if(req_queue-&gt;q_head == NULL){
      printf("***Error - Queue is Empty***\n");
      return(NULL);
    }
    loc = req_queue-&gt;q_head;
    first_req = loc-&gt;trackNumber;
    if(req_queue-&gt;q_head == req_queue-&gt;q_tail){
      req_queue-&gt;q_tail = NULL;
      req_queue-&gt;q_head = NULL;
      return first_req;
    }
    req_queue-&gt;q_head = loc-&gt;next;
    free(loc);
    return first_req;
  }
  </code></pre>