注册 登录
编程论坛 C语言论坛

帮我看一下出了什么问题

mm1746886443 发布于 2019-12-15 16:38, 1399 次点击
TYPE *delete(TYPE * head,int num)
{
TYPE *pf,*pb;
if(head==NULL)                        /*如为空表,输出提示信息*/
{
    printf("\nempty list!\n");
    goto end;
}
    pb=head;
    while(pb->num!=num&&pb->next!=NULL)                 /*当不是要删除的结点,而且也不是最后一个结点时继续循环*/
{
        pf=pb;pb=pb->next;                            /*pf指向当前结点,pb指向下一个结点*/
}                                                   
    if(pb->num==num)
{
    if(pb==head)  haed=pb->next;                                                /*如找到被删结点,且为第一结点,则使head指向第二个结点否则使pf所指结点的指针指向下一个结点  */
    else
    pf->next=pb->next;
    free(pb);
    printf("The node is deleted\n");
}
    else
    printf("The node not been foud!\n");
    end:
        return head;
}
/*下面是问题*/
error C2143: syntax error : missing '{' before '*'
 error C2143: syntax error : missing ')' before '*'
 error C2143: syntax error : missing '{' before '*'
 error C2059: syntax error : 'type'
 error C2059: syntax error : ')'
1 回复
#2
wolf_555552019-12-15 23:16
16行有一个head打错了;
end:是什么?去掉试试!
1