1 #include <cstdio> 2 #include <iostream> 3 #include <cstring> 4 #include <string> 5 #include <cmath> 6 #include <algorithm> 7 using namespace std; 8 const int N = 1000; 9 10 struct weapon{ 11 int price; 12 int atk; 13 struct weapon * next; 14 }; 15 16 int main() 17 { 18 struct weapon a,b,c, *head; 19 a.price=100; 20 a.atk=100; 21 b.price=200; 22 b.atk=200; 23 c.price=300; 24 c.atk=300; 25 head =&a; 26 a.next=&b; 27 b.next=&c; 28 c.next=NULL; 29 struct weapon *p; 30 p= head; 31 while(p!=NULL){ 32 printf("%d %d\n",p->atk,p->price); 33 p=p->next; 34 } 35 return 0; 36 }
静态链表
原创
©著作权归作者所有:来自51CTO博客作者心流灬灬的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
【数据结构】链式家族的成员——循环链表与静态链表
【数据结构】第二章——线性表(8)详细介绍了循环链表与静态链表的相关内容……
数据结构 C语言 循环链表 静态链表 -
静态链表排序
文章目录1、问题介绍2、思路3、样例4、代码实现1、问题介绍给定几个节点,最终输
PAT ci 代码实现 i++