#include <stdio.h>
void test_fun1(int input, int tmp)
{
printf("%s(%d)...%d\n", __FUNCTION__, input, tmp);
}
void test_fun2(int input, int tmp)
{
printf("%s(%d)***%d\n", __FUNCTION__, input, tmp);
}
typedef void (*function_ptr)(int, int);
int main()
{
function_ptr op_fun;
void (*fun_ptr)(int, int);
fun_ptr = test_fun1;
fun_ptr(2, 3);
fun_ptr = test_fun2;
fun_ptr(7, 6);
printf("-------\n");
op_fun = test_fun1;
op_fun(77, 11);
printf("-------\n");
return 0;
}
[Output]:
test_fun1(2)...3
test_fun2(7)***6
-------
test_fun1(77)...11
-------
沒有留言:
張貼留言