歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> C的結構體鏈表舉例子

C的結構體鏈表舉例子

日期:2017/3/1 10:36:57   编辑:Linux編程

#include<stdio.h>
#include"stdlib.h"

void main(void)
{

struct bb{

char num;
char score;
struct bb *next;

}xb0,xb1,xb2,xb3,*head,*PC;

xb0.num=1;
xb0.score=60;
xb1.num=2;
xb1.score=65;
xb2.num=3;
xb2.score=70;
xb3.num=4;
xb3.score=75;

head=&xb0;
xb0.next=&xb0;
xb1.next=&xb2;
xb2.next=&xb3;
xb3.next=NULL;
printf("every things is OK !!\n");

PC=(struct bb*)calloc(2,sizeof(struct bb));
free(PC);
}

。。。。。。。。。。。。。。這是隨意寫的一個C語言結構體的鏈表~~~~

Copyright © Linux教程網 All Rights Reserved