编译环境:VC++6.0
#include
#include
typedef struct LNode
{
int data;
struct LNode *next;
}LNode,*LinkList;
LinkList Init_LNode() //链表初始化
{
LNode *L;
L = (LinkList)malloc(sizeof(LNode));
if(L == NULL)
{
printf("初始化失败!\n");
exit(-1);
}
L->next = NULL;
return L;
}
void Creat_List1(LNode *L) //头插法
{
int i,n,num;
LNode *pnew;
printf("请输入要输入的元素个数:n = ");
scanf("%d",&n);
for(i=0;i
{
printf("请输入第%d个数:",i+1);
scanf("%d",&num);
pnew = (LinkList)malloc(sizeof(LNode));
pnew->data = num;
pnew->next = L->nex