一次性编码搞定, 建立单链表并打印链表节点值.
linklist.c
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#define DEBUG_PRT(fmt,arg...) printf(fmt,##arg)
typedef struct linklist
{
int value;
struct linklist *next;
}Mylist_s;
Mylist_s *create_list(int number)
{
Mylist_s *head = NULL;
Mylist_s *p = NULL;
Mylist_s *s= NULL;
int i = 0;
if(NULL == (head = (Mylist_s *)malloc(sizeof(Mylist_s))))
{
DEBUG_PRT("malloc error \n");
exit(1);
}
head->value = -1;
head->next = NULL;
p = head;
for(i=0; i<number; i++)
{
if(NULL == (s = (Mylist_s *)malloc(sizeof(Mylist_s))))