无
无人的世界
Unregistered / Unconfirmed
GUEST, unregistred user!
#include<stdio.h>
#include<malloc.h>
#include<string.h>
#define NULL 0
typedef struct ElemType
{char *s;
int age;
int number;
}ElemType;
typedef struct LNode
{ElemType data;
struct LNode *next;
}LNode,*LinkList;
LListInit(LinkList &L)
{L=(LinkList)malloc(sizeof(LNode));
if(!L) return 0;
L->next=NULL;
return 1;
}
void LListInsert(LinkList &L,int i,LNode * e)
{LNode *p;
p=L->next;
while(p)
p=p->next;
p->next->data=e->data;
p->next->next=e->next;
}
void main()
{ LinkList L;int i=1;
LNode *e;LListInit(L);
e=(LNode*)malloc(sizeof(LNode));
e->data.number=2;
e->data.age=5;
strcpy(e->data.s,"he");
e->next=NULL;
LListInsert(L,i,e);
}
#include<malloc.h>
#include<string.h>
#define NULL 0
typedef struct ElemType
{char *s;
int age;
int number;
}ElemType;
typedef struct LNode
{ElemType data;
struct LNode *next;
}LNode,*LinkList;
LListInit(LinkList &L)
{L=(LinkList)malloc(sizeof(LNode));
if(!L) return 0;
L->next=NULL;
return 1;
}
void LListInsert(LinkList &L,int i,LNode * e)
{LNode *p;
p=L->next;
while(p)
p=p->next;
p->next->data=e->data;
p->next->next=e->next;
}
void main()
{ LinkList L;int i=1;
LNode *e;LListInit(L);
e=(LNode*)malloc(sizeof(LNode));
e->data.number=2;
e->data.age=5;
strcpy(e->data.s,"he");
e->next=NULL;
LListInsert(L,i,e);
}