#include
<
stdio.h
>
#include < stdlib.h >
#define TRUE 1
#define ERROR 0
#define BOOL int
typedef struct LNode
... {
int data;
LNode *next;
} LNode, * Linklist;
BOOL HeadNOde(Linklist * Head,Linklist * L, int temp)
... {
*Head = (Linklist )malloc(sizeof(LNode));
*L = (Linklist )malloc(sizeof(LNode));
if((!*Head)||(!*L))
...{
return ERROR;
}
(*Head)->next = *L;
(*L)->data = temp;
(*L)->next = NULL;
return TRUE;
}
BOOL InsertList(Linklist * L, int temp)
... {
Linklist L1 = (Linklist )malloc(sizeof(LNode));
if(!L1)
...{
return ERROR;
}
L1->data = temp;
L1->next = *L;
*L=L1;
return TRUE;
}
int main()
... {
Linklist Head,List;
int temp = 10;
HeadNOde(&Head,&List,temp);
for(int i=0;i<10;i++)
...{
InsertList(&List,i);
}
Linklist pList;
pList = List;
while(pList)
...{
printf("%d ",pList->data);
pList = pList->next;
}
return 0;
}
#include < stdlib.h >
#define TRUE 1
#define ERROR 0
#define BOOL int
typedef struct LNode
... {
int data;
LNode *next;
} LNode, * Linklist;
BOOL HeadNOde(Linklist * Head,Linklist * L, int temp)
... {
*Head = (Linklist )malloc(sizeof(LNode));
*L = (Linklist )malloc(sizeof(LNode));
if((!*Head)||(!*L))
...{
return ERROR;
}
(*Head)->next = *L;
(*L)->data = temp;
(*L)->next = NULL;
return TRUE;
}
BOOL InsertList(Linklist * L, int temp)
... {
Linklist L1 = (Linklist )malloc(sizeof(LNode));
if(!L1)
...{
return ERROR;
}
L1->data = temp;
L1->next = *L;
*L=L1;
return TRUE;
}
int main()
... {
Linklist Head,List;
int temp = 10;
HeadNOde(&Head,&List,temp);
for(int i=0;i<10;i++)
...{
InsertList(&List,i);
}
Linklist pList;
pList = List;
while(pList)
...{
printf("%d ",pList->data);
pList = pList->next;
}
return 0;
}