首页 > 代码库 > 链表的实现

链表的实现

#include<iostream>#include<stdlib.h>using namespace std;typedef int ElemType;typedef struct Node{    ElemType data;    struct Node* next;}*LinkList,Node;LinkList LinkListCreate(){    int data;    Node *L=(Node*)malloc(sizeof(Node));    if(L==NULL) cout<<"Error"<<endl;    L->next=NULL;    Node *r;    r=L;    while(cin>>data)    {        if(data<0) break;        Node *p=(Node*)malloc(sizeof(Node));        if(p==NULL) cout<<"Error"<<endl;        p->next=NULL;        p->data=http://www.mamicode.com/data;>