满意答案
oo1379oo
2016.09.26
采纳率:48% 等级:9
已帮助:116人
首先创建节点
typedef struct Node
{
int data;
Node *next;
}
创建头结点:
Node *head1 = NULL; //作为单链表的头结点
Node *head2 = NULL;//作为单链表的投节点
然后实现插入,删除, 排序等操作
eg: 插入
bool insert(int data)
{
if(head1 == NULL)
{
head1 = malloc(sizeof(struct Node));
head1->data = data;
head1->next = NULL;
}
Node *p = malloc(sizeof(struct Node));
p->data = data;
p->next = head1->next; //这个采用的是前插入法
}
直接在这上面写的, 可能会有错误,你自己去修改, 其他的我就不写了。。。
00分享举报