请高手帮忙看看 链表小问题!!!!
#include<stdio.h>#include<stdlib.h>
#include <string.h>
struct student
{
char name[];
int banji;
int fenshu;
int paiming;
struct student *next;
};/*创建一个学生结构体 */
struct student *head;/*创建一个学student类型的头指针 */
student *creat()/*该函数实现链表的创建和赋值 */
{
student *tail;
student *stop;/*创建两个student类型的指针 */
stop=new student;/*创建一个学student类型的头指针 */
printf("please enter the name/banji/fenshu of student\n ");
scanf("name is %c",&stop->name);
scanf("banji is %d",&stop->banji);
scanf("fenshu is %d",&stop->fenshu);
tail=stop;
while((strcmp(stop->name,"null")!=0))/*连续开辟空间并赋值,while的条件为stop->name不为空 */
{
if(head=NULL)
{head=stop;}
else
{
tail=stop;
}
stop=new student;
printf("please enter the name/banji/fenshu of student\n ");
scanf("name is %c",&stop->name);
scanf("banji is %d",&stop->banji);
scanf("fenshu is %d",&stop->fenshu);
tail->next=stop;
}
tail->next=NULL;
delete stop; /*删除最后的空tail */
return head;/*返回头指针 */
}
void show(student *p)/*该函数实现打印创建好的数据 */
{
student *q=p;
printf("name 1 banji 1 fenshu");
while(q->next!=NULL)
{
printf("%c 1 %c 1 %d",q->name,q->banji,q->fenshu);
q=q->next;
}
}
int main(void)
{
void show(student *creat());
system("pause");
}
该程序编译通过,但是没结果、