[PIC®/AVR®/dsPIC®产品] 链表是如何实现的

[复制链接]
103|1
捉虫天师 发表于 2025-10-16 21:52 | 显示全部楼层 |阅读模式
  1. #include <stdio.h>
  2. typedef struct node
  3. {
  4.         struct node * next;
  5.         int id;
  6. }  NODE;

  7. NODE nod[4];
  8. int main()
  9. {
  10.         nod[0].id=10;
  11.         nod[1].id=11;       
  12.         nod[2].id=12;       
  13.         nod[3].id=13;
  14.        
  15.         nod[0].next = & nod[1];
  16.         nod[1].next = & nod[2];
  17.         nod[2].next = & nod[3];
  18.         nod[3].next = & nod[0];       

  19.    printf("nod[%d].next->id:%d \n",0,nod[0].next->id);
  20.    printf("nod[%d].next->id:%d \n",1,nod[1].next->id);
  21.    printf("nod[%d].next->id:%d \n",2,nod[2].next->id);
  22.    printf("nod[%d].next->id:%d \n",3,nod[3].next->id);       
  23.        
  24.    return 0;
  25. }


 楼主| 捉虫天师 发表于 2025-10-16 21:52 | 显示全部楼层
nod[0].next->id:11
nod[1].next->id:12
nod[2].next->id:13
nod[3].next->id:10
您需要登录后才可以回帖 登录 | 注册

本版积分规则

214

主题

3280

帖子

7

粉丝
快速回复 在线客服 返回列表 返回顶部