printf("分配内存给新节点\n");
New = (Link)malloc(sizeof(Node));
if(New == NULL) {
printf("节点内存分配失败\n");
}
else {
printf("节点内存分配成功\n");
printf("输入数据项1( int ) : ");
scanf("%d",&newNumber);
printf("输入数据项2( <=10 char ) : ");
scanf("%s",newName);
New->number = newNumber;
for(i=0;i<=MAX;i++) {
New->name[i] = newName[i];
}
New->Next = NULL;
printf("数据项保存到节点\n");
printf("节点数据输出 : \n");
printf("数据项1 : %d\n",New->number);
printf("数据项2 : %s\n",New->name);
}
文章来源于领测软件测试网 https://www.ltesting.net/