c数据结构 -- 链表的理解

时间:2020-01-27 17:14:06   收藏:0   阅读:44

链表是结构体变量与结构体变量链接在一起,怎么链接在一起?通过指针

#include <stdio.h>
struct Node{
    int data;
    struct Node* next;
};
int main(void)
{
    struct Node node1 = {
        1,NULL
    };
    struct Node node2 = {
        3,NULL
    };
    struct Node node3 = {
        3,NULL
    };
       node1.next = &node2;
    node2.next = &node3;
    return 0;
}

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!