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;
}
相关推荐
祈安_3 天前
C语言内存函数
c语言·后端
郑州光合科技余经理5 天前
代码展示:PHP搭建海外版外卖系统源码解析
java·开发语言·前端·后端·系统架构·uni-app·php
feifeigo1235 天前
matlab画图工具
开发语言·matlab
dustcell.5 天前
haproxy七层代理
java·开发语言·前端
norlan_jame5 天前
C-PHY与D-PHY差异
c语言·开发语言
多恩Stone5 天前
【C++入门扫盲1】C++ 与 Python:类型、编译器/解释器与 CPU 的关系
开发语言·c++·人工智能·python·算法·3d·aigc
QQ4022054965 天前
Python+django+vue3预制菜半成品配菜平台
开发语言·python·django
czy87874755 天前
除了结构体之外,C语言中还有哪些其他方式可以模拟C++的面向对象编程特性
c语言
遥遥江上月5 天前
Node.js + Stagehand + Python 部署
开发语言·python·node.js
m0_531237175 天前
C语言-数组练习进阶
c语言·开发语言·算法