摘要: 一下是自己学习并编写的链表的创建和输出过程,简单易懂。#include <stdio.h>#include <stdlib.h>#include <malloc.h>struct ListNode{ int data; struct ListNode *next;};typedef struct ListNode list;list *createList(int b){ int i,a; list *head=NULL,*curNode=NULL,*tailNode=NULL; //此处除head,我们创建两个指针curNode和tailNode ... 阅读全文
posted @ 2012-10-02 16:38 foundwant 阅读(377) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <stdlib.h>#include <malloc.h>typedef struct ListNode{ int data; struct ListNode *next;}inversList;/*这个函数实现创建链表*/inversList *createList(){ inversList *head=NULL,*a=NULL,*b=NULL; //定义了指针之后最好清空,以免野指针的出现, //比如这里的head如果不设置为... 阅读全文
posted @ 2012-10-02 10:14 foundwant 阅读(366) 评论(0) 推荐(0) 编辑