【发布时间】:2021-06-30 14:39:50
【问题描述】:
我有两个函数,其中一个调用另一个函数,标题是我得到的错误。我只是想知道我是否缺少一个简单的修复程序。如果需要更多信息,请告诉我。谢谢!
node createNode() {
newNode temp;//declare node
temp = (newNode)malloc(sizeof(struct node));//allocate memory
temp->next = NULL;//next point to null
return *temp;// return the new node
}
void enqueue(queue* q, customer* data) {
// Create a new LL node
struct node* temp = createNode(data);//error line
【问题讨论】:
-
createNode应该返回一个node *。 -
typedef struct node node;存在于任何地方? -
发布代码或错误时请准确无误。在您的错误消息中似乎缺少
*。您尝试初始化类型struct node*而不是struct node。