
struct student *del(struct student *head,long num)
{
struct student *p1,*p2;
if(head==NULL) {printf("\nlist null!");goto end;}
p1=head;
while(num!=p1->num&&p1->next!=NULL)
{p2=p1;p1=p1->next;}
if(num==p1->num)
{
if(p1==head)head=p1->next;
else p2->next=p1->next;
printf("delete:%ld\n",num);
n=n-1;
}
else printf("%ld not been found! \n",num);
end;
return(head);
}
我用VC++6.0编译时,主函数main调用这个del函数时,提示'end':undeclared identifier,上面的函数是谭浩强老师书里面的,请问为什么会报错,end起什么作用,不要goto end语句可以吗?
end后面是冒号蠢租不是封号
goto end 表示跳转到end 执行其羡则后面的语句
尽带派兆量不用用goto语句