<分区>
我正在用 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;
}
在第 24 行(R->next = temp
),编译器告诉我:
dereferencing pointer to incomplete type 'struct Queue_node'.
我无法访问 R->next after
声明,为什么?