I'm creating a queue datastructure in c.
typedef struct Queue_node{
int value;
struct Queue_Node* next;
};
struct Queue_Node* front = NULL;
struct Queue_Node* R = NULL;
void Enqueue(int x)
{
struct Queue_node* temp = (struct Queue_node*)malloc(sizeof(struct Queue_node*));
temp->value = x;
temp->next = NULL;
if (front == NULL && R == NULL)
{
R = temp;
front = R;
return;
}
R->next = temp;
R = temp;
}
At line 24 (R->next = temp
), the compiler tells me:
dereferencing pointer to incomplete type 'struct Queue_node'.
I cant access R->next after
the declarations, why?