// test12.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
void func(int i)
{
printf("This is for test %i
", i);
}
<!-- frame contents -->
<!-- /frame contents -->
typedef void (*PFUNC)(int);
strUCt FUNC
{
PFUNC pfunc;
};
void callfunc(void pfunc(int), int i)
{
pfunc(i);
}
int main(int argc, char* argv[])
{
void (*pfunc)(int);
pfunc = &func;
pfunc(1);
callfunc(pfunc, 2);
FUNC sfunc;
sfunc.pfunc = &func;
sfunc.pfunc(3);
return 0;
}
更多內容請看C/C++技術專題專題,或