单链表问题
怎么建立一个不带头结点的单链表,能给一两个例子最好
程序代码:#include <stdio.h>
#include <malloc.h>
typedef struct node
{
short data;
struct node *next;
}*list;
list Create_list( list L )
{
short get_input;
list temp;
printf("\t 输入正数以空格隔开!\n");
while( scanf("%d", &get_input ) != EOF )
{
temp = (list) malloc (sizeof(struct node));
temp->next = L;
temp->data = get_input;
L = temp;
}
return L;
}
void Print_list( list L )
{
while( NULL != L )
{
printf("%d ", L->data);
L = L->next;
}
printf("\n");
return;
}
int main()
{
list L = NULL;
L = Create_list( L );//创建单链表
Print_list( L ); //在控制台打印出单链表L
return 0;
}









henhaode