我在聲明結構時犯了錯誤嗎?我試着根據這個錯誤檢查幾個其他類似的問題,但仍然無法找到解決方案。需要你的幫助來解決它。感謝提前。C結構錯誤:取消引用指向不完整類型的指針
#include <stdio.h>
#include <stdlib.h>
struct Node{
int info;
struct node *link;
} ;
void display(struct node *start);
int main()
{
struct node *start=NULL;
int choice;
int num;
while(1)
{
printf("\n1. Display \n9. Exit \n");
printf("\nEnter your choice\n\n\n");
scanf("%d",&choice);
switch(choice)
{
case 1:
display(start);
break;
default:
printf("\nInvalid choice");
}
}
}
void display(struct node *start)
{
struct node *p;
if(start==NULL)
{
printf("List Is Empty");
return;
}
p=start;
while(p!=NULL)
{
printf("%d",p->info); // Getting Error in these 2 Lines
p=p->link; // Getting Error in these 2 Lines
}
}
'結構沒有Node'不是與'struct node'相同的東西。 – aschepler
@aschelper謝謝,我不知道,它工作。感謝幫助。 Cud你解釋他們之間的區別? – harsher
區別是大寫N :)。開玩笑。 * C *區分大小寫。 –