请教两行代码的功能
1:typedef void (*p_time_server_proc_run)(void);2:extern p_time_server_proc_run g_time_server_proc_run5; 第一句话是定义了一个函数指针。函数没有返回值。没有传参
第二句话是把g_time_server_proc_run5变量对外声明。
举例说明:
我在a.c文件里面这样写的
typedef void (*p_time_server_proc_run)(void);
p_time_server_proc_run g_time_server_proc_run5;
void func(void)
{
printf("test");
}
g_time_server_proc_run5 = func;
然后我在b.c文件里面想用g_time_server_proc_run5这个全局变量。那么就需要extern这个变量。
等价于
int a;
extern int a;
学习一下函数指针就知道是怎么回事了! 第一句话是定义了一个函数指针。函数没有返回值。没有传参
第二句话是把g_time_server_proc_run5变量对外声明。
页:
[1]