ZoeGreenn 2015-12-04 07:00 采纳率: 0%
浏览 1406

[求解!]打印链表元素主程序出错

主程序如下;

 #include "list.h"
#include <stdio.h>
#include <stdlib.h>

struct Node
        {
            ElementType Element;
            Position    Next;
        };

int main(){
    List list= malloc( sizeof( struct Node ) );
    Position P=list;
    for(int i=0;i<10;i++){
        Insert(i,list,P);
        P=P->Next;
    }
    P=list->Next; //注意不是P=list
    for(int j=1;j<=10;j++){
        printf("%d\n",P->Element);
        P=P->Next;
    }

    if(!IsEmpty(List list))
       printf("not empty");

    Delete(ElementType 4,List list);
    P=list->Next; 
    for(int j=1;j<=10;j++){
        printf("%d\n",P->Element);
        P=P->Next;
    }    

    return 0;
}

编译时出错如下:

 zoegreen@zoegreen-Lenovo-IdeaPad-Y470:~/桌面$ gcc main.c list.c -o list
main.c: In function ‘main’:
main.c:24:17: error: expected expression before ‘List’
     if(!IsEmpty(List list))
                 ^
main.c:27:12: error: expected expression before ‘ElementType’
     Delete(ElementType 4,List list);
            ^
main.c:27:12: error: too few arguments to function ‘Delete’
In file included from main.c:1:0:
list.h:16:14: note: declared here
         void Delete( ElementType X, List L );
              ^

求大神解答~谢谢~

  • 写回答

1条回答 默认 最新

  • threenewbee 2015-12-04 07:08
    关注

    if(!IsEmpty(List list))
    ->
    if(!IsEmpty(list))

    别的类似

    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料