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)
Question
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)
OTHER TIPS
error c2664 : cannot convert parameter 1 from "link **" to "link *" when calling QUEUEget(&head).
This is telling you that the QUEUEget
function is expecting a link*
(a pointer to a link
) as its parameter, but you're passing it a link**
(a pointer to a pointer to a link
).
In your receive
function, the parameter head
is already a link*
:
void receive(link *head);
However, in this line, you're passing the address of head
(i.e. a pointer to a link*
)to QUEUEget
:
QUEUEget(&head);
Instead, just pass head
directly:
QUEUEget(head);