首页 > 其他 > 详细

静态链表

时间:2017-08-15 19:37:56      阅读:197      评论:0      收藏:0      [点我收藏+]
 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 }

静态链表

原文:http://www.cnblogs.com/shixinzei/p/7366914.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!