静态链表

来源:互联网 发布:朱高煦 知乎 编辑:程序博客网 时间:2024/06/18 17:55

简单静态链表

// 简单静态链表#include <iostream>using namespace std;struct  student  {  long num;  float score;  struct student *next; //该指针指向student类型的结构体};//注意必须有分号int main(){  struct student a,b,c,*head,*p;  a.num=34341;  a.score=81.5;  b.num=34343;  b.score=97;  c.num=34344;  c.score=82;  head=&a;  a.next=&b;  b.next=&c;  c.next=NULL;  p=head;  do  //输出记录   {     cout<<p->num<<" "<<p->score<<endl;     p=p->next;  }while(p!=NULL);   getchar();}
原创粉丝点击