单链表打印

代码实现

void dumpList(st_dataNode * head){
	if(NULL == head){
		return;
	}

	st_dataNode * p = NULL;
	
	printf("========= Dump List %p ===========\n\t", head);
	p = head;
	while (NULL != p){
		printf(" %d ", p->data);
		p = p->next;
	}
	printf("\n");
	printf("===================================\n");
}

调试编译

gcc listMain.c list.c -o a.exe -DDEBUG

调试输出

========= Dump List 0x1b94010 ===========
         22  32  19  53  0  47  29  116  4  6
===================================
发布了191 篇原创文章 · 获赞 43 · 访问量 26万+

猜你喜欢

转载自blog.csdn.net/leoufung/article/details/104333451