#include
struct node
{
int num;
struct node next;
}*head,*p,*pnew;
struct node *create(void)
{
int i,n;
//pnew为新生成的节点指针,head为链表的头指针
struct node *head,*pnew;
struct node *p;//p尾标尾指针
printf("please input the node numbers:\n");
scanf("%d",&n);//n为链表中的节点个数
if(n>0)
{
printf("please input %d date:\n",n);
head=(struct node)malloc(sizeof(struct node));//生成第一个节点
p=head;
if(head!=NULL)
{
scanf("%d",&head->num);
head->next=NULL;
}
else
{
printf("Application for memory failure!\n");
exit(1);
}
for(i=1;i
{
pnew=(struct node*)malloc(sizeof(struct node));
if(pnew!=NULL)
{
scanf("%d",&pnew->num);
p->next=pnew;
p=pnew;
}
else
{
printf("Application for memory failure!\n");
exit(1);
}
p->next=NULL;//表尾置null
}
}
else
{
printf("n<=0\n");
head=NULL;
}
return head;
}
这个程序一运行就显示scanf和printf未定义,求助!!谢谢