如何给链表录入数据

如何给链表录入数据

struct Node
{
int value;
struct Node *next;
};
1.先建立链表。
2.数据录入
void inputdata(Node *head)
{
Node *p;
int num;
p = head;
while(cin>>num && p != NULL)
{
p->value = num;
p = p->next;
}
}
温馨提示:答案为网友推荐,仅供参考
相似回答