c++中链表使用指向指针的指针

关于c++中链表的另一种表达为什么一直出错呢
#include
using namespace std;
struct student
{
int num;
student **next;
};
student *CreatList(int n)
{
student *head=0,*tail=0;
for(int i=1;i<=n;++i)
{
student *p=new student;
cin>>p->num;
if(head==0)
{
head=tail=p;
p->next=0;
}
else
{
tail->next=&p;
tail=p;
p->next=0;
}
}
return head;
}
void disply(student a)
{
while(a)
{
cout<num;
a=
(a->next);
}
}
int main()
{
int n;
cin>>n;
student *a=CreatList(n);
disply(a);
return 0;
}
我将下一个结点的地址放置在当前结点指向指针的指针中,一直编译错误,哪位大神可以帮忙解答一下,非常感谢。

猜你喜欢

转载自blog.csdn.net/qq_43044237/article/details/82820516
今日推荐