- 论坛徽章:
- 13
|
本帖最后由 hmchzb19 于 2014-05-20 13:25 编辑
- #include<stdio.h>
- #include<stdlib.h>
- #include<malloc.h>
- typedef int DataType;
- typedef struct ListNode{
- DataType data;
- struct ListNode *next;
- }Node,*LinkList;
- void InitList(LinkList *head)
- {
- if((*head=(LinkList)malloc(sizeof(ListNode)))==NULL)
- exit(-1);
- (*head)->next=NULL;
- }
复制代码 gcc -o testll testll.c
In file included from testll.c:3:
LinkList.h: In function ‘InitList’:
LinkList.h:13: error: ‘ListNode’ undeclared (first use in this function)
LinkList.h:13: error: (Each undeclared identifier is reported only once
LinkList.h:13: error: for each function it appears in.)
应该是Node ,不是ListNode |
|