我正在将一个程序从 Pascal 翻译成 C。我已经很多年没有使用 C 语言了。这是相关的代码片段:
typedef struct querec* queptr;
struct querec {
char item;
queptr next;
};
struct queue {
queptr front,
rear;
};
struct queue qnum[5];
char item;
const char remove(struct queue *q)
{
queptr p;
char remove_result;
p = q->front;
remove_result = p->item;
q->front = p->next;
if (q->front == NULL)
q->rear = NULL;
return remove_result;
}
main()
{
...
item = remove(&qnum[3]);
}
它无法在 Visual Studio 2015 中编译,并报告以下内容:
警告 C4133“function”:不兼容的类型 - 从“queue *”到“const char *” 错误 C2373“删除”:重新定义;不同类型修饰符