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
Constantly working on "it" 
[This message was edited by hellfire on January 20, 2002 at 23:09.]
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
[This message was edited by hellfire on January 20, 2002 at 23:09.]