求助关于C++简单代码!!!!!!!!
void Insert(Student* first1,Student* stud)//插入函数{
if(first1==NULL)//判断链首指针是否为空
{
first1=stud;
stud->next=NULL;
return;
}
if(first1->num1>stud->num1)//插入到链首
{
stud->next=first1;
first1=stud;
return;
}
Student* pGuard=first1;
while(pGuard->next&&pGuard->next->num1<stud->num1)//插入到中间
{
pGuard=pGuard->next;
stud->next=pGuard->next;
pGuard->next=stud;
}
return;
}
请帮忙解决一下,每次在主程序中插入的数据都输出不了,谢谢