编码注释,讲讲也行
来源:百度知道 编辑:UC知道 时间:2024/06/24 11:03:03
#include <stdio.h>
typedef void (*Print_fun_t)(int a);
Print_fun_t fp;
void
print_func(int a)
{
if (1) {
printf("Hello %d \n", a);
;
} else
;
}
void
entryApi(Print_fun_t func)
{
fp = func;
}
int
main(void)
{
entryApi(print_func);
fp(2008);
// print_func();
getch();
}
typedef void (*Print_fun_t)(int a);
Print_fun_t fp;
void
print_func(int a)
{
if (1) {
printf("Hello %d \n", a);
;
} else
;
}
void
entryApi(Print_fun_t func)
{
fp = func;
}
int
main(void)
{
entryApi(print_func);
fp(2008);
// print_func();
getch();
}
#include <stdio.h>
typedef void (*Print_fun_t)(int a); //定义一个函数指针类型Print_fun_t
Print_fun_t fp; //声明一个一个函数指针变量,没有实体
void //定义一个实体函数
print_func(int a)
{
if (1) {
printf("Hello %d \n", a);
;
} else
;
}
void //定义一个将定义的函数指针fp实体化的函数
entryApi(Print_fun_t func)
{
fp = func;
}
int
main(void)
{
entryApi(print_func); //将fp指向print_func函数 即fp与print_func等价了
fp(2008); //调用函数,即print_func(2008);
// print_func();
getch();
}