1 函数指针的定义和调用
简单的函数指针
void (*fun)(void)
再定义个函数实体
void hello(void)
{
printf("hello world");
}
调用时 fun = hello;
(*fun)();
当某个地址就是函数的入口地址
也可以这样用
fun = (void (*)(void))0x37010000;
fun();( fun 和 (*fun)都指函数的地址 ,加上()指调用;
3往内存地址中写数据
#define UTXH0 (*(voaltile unsigned int *)0x12345678)
UTXH0 = 0x123;(写数据)
也可以
int *p = (volatile int *)0x12345678;
*p = 0x123;
本文介绍了函数指针的基本概念及使用方法,并演示了如何通过函数指针调用函数实例。此外,还展示了如何利用指针进行特定内存地址的数据写入操作。

615

被折叠的 条评论
为什么被折叠?



