C语言 怎么在switch里引用链表 ?

head=create();

动态创建一个内存空间用malloc函数,返回一个指针p,指向这个空间,这个指针就是你所需要的动态链表。

typedef struct booknode{    ………    ………}Node, *BOOK;BOOK book=(Node*)malloc(sizeof(Node*));

#include<stdlib.h>/****定义链表****/const int Maxsize=100;typedef struct {char bookname[50];int bookindex;double bookprice;} Eletype;typedef struct node{Eletype data;struct node* next;}Node, *Linklist;/****初始化链表****/Linklist Create(){Linklist temp;temp=(Node *)malloc(sizeof(Node *));return temp;}void main(){Linklist head;head=Create();}

970797游戏攻略网 » C语言 怎么在switch里引用链表 ?

赞 (0)