链表该怎么学?
找了很多资料,看了看,查了查,写了写还是觉得链表很难理解,求大神用亲身感悟谈谈链表该如何学? 先学汇编语言,然后彻底弄懂指针,之后链表还有难度吗?本帖最后由 bin554385863 于 2019-10-4 01:35 编辑
....
type struct _list
{
char c;
struct _list *next
} node;
node* creatlist(node* h, char _end)
{
node *e = (node *)malloc(sizeof(node));
h = e;
char var = '\0';
while(1)
{
scanf("%c", &var);
if(var == _end)
{
e->c = '\0';
e->next = NULL;
break;
}
e->c = var;
e->next =(node *)malloc(sizeof(node));
e = e->next;
}
e->next = NULL;
}
retern h;
页:
[1]