为什么我的代码的p->next不能指向NULL?
#include <stdio.h>
#include <stdlib.h>
typedef struct T_Node{
int d;
struct T_Node *next;
} Node, *List;
void createlink(List *pf)
{
int i;
Node *p;
*pf = (Node *)malloc(sizeof(Node));
p = *pf;
for(i = 1; i <= 99; i++)
{
p->d = i;
p->next = (Node *)malloc(sizeof(Node));
p = p->next;
}
p->d = 100;
p->next = NULL; //为什么编辑器上面报错Use of undeclared identifier 'NULL'
}
double getaverage(List f, int *nodenum){
return 0;
}
int main(int argc, char* argv[])
{
int n;
List f;
double a;
createlink(&f);
a = getaverage(f, &n);
printf("%d %lf\n",n, a);
return 0;
}