亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

請問,goto end;可以用什么函數替換?可以舉個例子嗎?

請問,goto end;可以用什么函數替換?可以舉個例子嗎?

www說 2021-09-19 13:13:18
struct student *del(struct student *head,long num){struct student *p1,*p2;if(head==NULL){printf("\n空鏈表\n");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("刪除:%ld\n",num);n=n-1;}else printf("%ld 沒有找到!",num);end;return(head);}我用的dev c++,沒有end。這個例子是譚浩強書上的。
查看完整描述

1 回答

?
大話西游666

TA貢獻1817條經驗 獲得超14個贊

struct student *del(struct student *head,long num)
{
struct student *p1,*p2;
int flag = 1;
if(head==NULL)
{
printf("\n空鏈表\n");
flag = 0;
}
if(flag)
{
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("刪除:%ld\n",num);
n=n-1;
}
else printf("%ld 沒有找到!",num);
}
return(head);
}



查看完整回答
反對 回復 2021-09-23
  • 1 回答
  • 0 關注
  • 300 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號