C + Queue + Pointer Problem

Status
You're currently viewing only hellfire's posts. Click here to go back to viewing the entire thread.
Not open for further replies.
Hello All,

I am attempting to build a queue ADT using Linked Lists in C. The following is the relevant code fragment...


typedef struct QueueNodeTag
{
char data[MAXLEN];
struct QueueNodeTag * next;
} QueueNode;

typedef struct
{
struct QueueNode *head;
struct QueueNode *tail;
} Queue;
...
...
void Insert (Queue *q, char *to_be_sent)
{
QueueNode *temp;
...
>>> q -> head = temp; // Special case for the first
>>> q -> tail = temp; // element in the Linked List
}


The problem is with the statements marked >>> At this point the compiler returns a:
"warning: assignment from incompatible pointer type".

I don't understand, q->head is of type QueueNode, and temp is also of type QueueNode...

All your help is appreciated. Thanks.

Regards,
Hellfire
:D Constantly working on "it" :D

[This message was edited by hellfire on January 20, 2002 at 23:09.]
 
Status
You're currently viewing only hellfire's posts. Click here to go back to viewing the entire thread.
Not open for further replies.