标准c语言基础教程 练习13.1 编程练习 第4题 答案

#include <stdio.h>
struct int_node{
	int value;
	struct int_node * next;
};
void display_int_list(struct  int_node * con)
{
	while (con)
	{
		printf("%d\n", con->value);
		con = con->next;
	}
}
int main()
{
	struct int_node arr_node[10] = {
		{ 1, NULL },
		{ 2, NULL },
		{ 3, NULL },
		{ 4, NULL },
		{ 5, NULL },
		{ 6, NULL },
		{ 7, NULL },
		{ 8, NULL },
		{ 9, NULL },
		{ 10, NULL },
	};
	struct int_node *first = (struct int_node *)arr_node;
	for (int i = 0; i < 10 - 1; i++)
		arr_node[i].next = &arr_node[i + 1];
	display_int_list(first);
}
发布了111 篇原创文章 · 获赞 13 · 访问量 3128

猜你喜欢

转载自blog.csdn.net/wx_assa/article/details/103485158