#include "stdafx.h"
#include <iostream>
using namespace std;
typedef void (*PF)();
void func()
{
cout << "func" << endl;
}
void caller( PF pf)
{
pf();
}
int main()
{
PF p = func;
caller(p);
system("pause");
return 0;
}
----------------------------------------------
func
続行するには何かキーを押してください . . .
Press any key to continue
-----------------------------------------------
#include <iostream>
using namespace std;
typedef void (*PF)();
void func()
{
cout << "func" << endl;
}
void caller( PF pf)
{
pf();
}
int main()
{
PF p = func;
caller(p);
system("pause");
return 0;
}
----------------------------------------------
func
続行するには何かキーを押してください . . .
Press any key to continue
-----------------------------------------------
typedef int pa
#include "stdafx.h"
typedef int* d;
typedef int (*func_pointer)(int, int);
int max(int a,int b)
{
printf("max fun");
return a>b?a:b;
}
void view(func_pointer pFun)
{
printf("view---->%d\n",(int)pFun(67,55));
}
int main(int argc, char* argv[])
{
int a = 2;
d p = &a;
// pa n = a;
func_pointer pFun = max;
view(pFun);
//printf("Hello World!%d\n",(int)pFun(66,55));
return 0;
}