Search code examples
c++c2664

Error C2664 , need clarification


I use this function in my programm and I call it by receive(&head);.I am doing something wrong and get an error c2664 : cannot convert parameter 1 from "link **" to "link *" when calling QUEUEget(&head). If I understand it right (*head) is a link to another link so I should do something like (&(&head)) but it doesn't work.

   void receive(link *head){
        int j;
        for (j=0;j<WINDOW;j++){
         if (((*head)->status==PENDING) || ((*head)->status==NEW)) {
             (*head)->status=ACK;
              printf("Packet No. %d: %d\n",(*head)->packetno,(*head)->status);
              QUEUEget(&head);
            }
        }
    }

Solution

  • Presumably in this context

    QUEUEget(&head);
    

    head is a link*. You are passing the address, which gives you a pointer to pointer, i.e. link**. You probably need

    QUEUEget(head)