C语言函数指针
作者:互联网
#include "stdio.h" void (*tprint_p)(void); void tprint(void) { printf("hello world\r\n"); } void main(void) { tprint_p = tprint; tprint_p(); (*tprint_p)(); printf("tprint_p: 0x%x\r\n", (int)tprint_p); printf("(*tprint_p): 0x%x\r\n", (int)(*tprint_p)); int aa = 12; int *tint = &aa; printf("tint: 0x%x\r\n", (int)tint); printf("(*tint): 0x%x\r\n", (int)(*tint)); }
类比整型指针变量,取指针内容是存储的值,而函数指针取其存储的值就是函数,也就还是函数地址。
标签:tint,int,void,C语言,printf,函数指针,0x%,tprint 来源: https://www.cnblogs.com/chenxiaolinembed/p/15060956.html