函數指針強制類型轉換

// ccc.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"

struct fdes_entry {
int (*fdes_rfunc)();
};


// DWORD MyFun(int arv); 
DWORD MyFunc(int a);
void Test(DWORD(*rFunc)());
struct fdes_entry fdes_entry1 = { 0 };

int _tmain(int argc, _TCHAR* argv[])
{
Test((DWORD(*)())MyFunc);
return TRUE;
}

void Test(DWORD(*rFunc)())
{
int cnt;
cnt = rFunc();
//rFunc(33);
//*FunP = rFunc;
fdes_entry1.fdes_rfunc = (int(*)()) rFunc;
(*(DWORD (*)(int))fdes_entry1.fdes_rfunc)(10);

//FunP(55);
printf("hejian");
scanf("%*c");
}

DWORD MyFunc(int a)
{
return a;
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章