I am writing a queue implementation program(in c) that has 2 node variables, front and rear. I declared them as follows,
struct queue
{
NODE* front, rear;
int size;
};
Upon compilation, I get the following error,
error: incompatible types when assigning to type ‘NODE’ {aka ‘struct node’} from type ‘void *’.
queue->rear = NULL;
For some reason it identifies rear to be of NODE type instead of NODE*
The code works fine when 'front' and 'rear' are declared separately as follows:
struct queue
{
NODE* front;
NODE* rear;
int size;
};
How do I declare multiple variables in a single line in a structure(in c)?