C语言相关内容模块

C语言相关内容模块

1、函数指针定义方式

函数指针的具体用法

2、静态链表实现


代码实现:

c 复制代码
#define _CRT_SECURE_NO_WARNINGS // 抑制 C4996 警告
#include <stdlib.h>
#include <string.h>
#include <stdio.h>

// 链表节点类型定义
struct LinkNode
{
	int data;
	struct LinkNode *next;

};

void test() {

	// 创建5个独立的节点
	struct LinkNode noed1 = { 10,NULL };
	struct LinkNode noed2 = { 20,NULL };
	struct LinkNode noed3 = { 30,NULL };
	struct LinkNode noed4 = { 40,NULL };
	struct LinkNode noed5 = { 50,NULL };

	// 创建链表
	noed1.next = &noed2;
	noed2.next = &noed3;
	noed3.next = &noed4;
	noed4.next = &noed5;

	// 遍历链表
	struct LinkNode *pCurrent = &noed1;

	while (pCurrent !=NULL)
	{
		printf("%d\n", pCurrent->data);
		pCurrent = pCurrent->next;
	}

}

int main() {

	test();
	system("pause");
	return 0;
}
相关推荐
九河_31 分钟前
解决pip install gym==0.19.0安装失败问题
开发语言·python·pip·gym
红豆诗人31 分钟前
C语言进阶知识--文件操作
c语言·开发语言·文件操作
麦麦鸡腿堡1 小时前
Java绘图技术
java·开发语言
热爱编程的OP2 小时前
Linux进程池与管道通信详解:从原理到实现
linux·开发语言·c++
武子康8 小时前
Java-171 Neo4j 备份与恢复 + 预热与执行计划实战
java·开发语言·数据库·性能优化·系统架构·nosql·neo4j
怪兽20149 小时前
fastjson在kotlin不使用kotlin-reflect库怎么使用?
android·开发语言·kotlin
ClearLiang9 小时前
Kotlin-协程的挂起与恢复
开发语言·kotlin
彭同学学习日志9 小时前
Kotlin Fragment 按钮跳转报错解决:Unresolved reference ‘floatingActionButton‘
android·开发语言·kotlin
海域云赵从友9 小时前
破解跨境数据传输瓶颈:中国德国高速跨境组网专线与本地化 IP 的协同策略
开发语言·php
咚咚王者10 小时前
人工智能之编程进阶 Python高级:第九章 爬虫类模块
开发语言·python