链表结构理解

2022/4/24 23:14:48

本文主要是介绍链表结构理解,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

#include <stdio.h>
#include <malloc.h>
struct node
{
    int date;
    struct node *next;
};
int main()
{
    struct node a,b,c,*head,*p;
    a.date=1;
    b.date=2;
    c.date=3;
    head=&a;    //head 存a的地址
    a.next=&b;  
    b.next=&c;
    c.next=NULL;
    p=head;
    do
    {
        printf("%d\n",p->date); //->表示地址指向
        p=p->next;
    }while(p);
    return 0;
}

 



这篇关于链表结构理解的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程