Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

单向链表的尾插法 #9

Open
kirinenko opened this issue Feb 6, 2024 · 0 comments
Open

单向链表的尾插法 #9

kirinenko opened this issue Feb 6, 2024 · 0 comments

Comments

@kirinenko
Copy link

void CreatListTail(LinkList &L, const size_t n)
{
Lnode *r = L;
for (int i = 0; i < n; ++i)
{
Lnode *p = new Lnode;
cin >> p->data;
p->next = NULL; #这里是不是应该改成NULL,原来写的是r->next
r->next = p;
r = r->next;
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant