86 *
87 *功能:遍历显示链表
88 *传入参数:链表的首地址
89 *
90 * **************************************************************************/
91 void displayList(NODE* pHead)
92 {
93 if (NULL==pHead) { /*链表的头指针为空*/
94 DEBUG("in displayList, pHead is NULL\n");
95 exit(-1);
96 }
97 if (NULL==pHead->next) { /*(链表的首个元素数据为0,没有使用)链表的首个节点指针还为NULL*/
98 DEBUG("in displayList, list is empty!\n");
99 exit(-1);
100 }
101
102 while(pHead->next!=NULL) /*链表不为空,遍历显示*/
103 {
104 printf("%d\n", pHead->next->x);
105 pHead=pHead->next;
106 }
107
108 DEBUG("displayList success!\n");
109 }
没有评论:
发表评论