[mw_shl_code=c,true]#include <REGX51.H>
#include "stdarg.h"
#include "string.h"
typedef unsigned char u8;
typedef struct
{
void *fun;
const unsigned char *str;
}FunTypeDef;
void k1()
{
u8 i;
i++;
i++;
}
void k2()
{
u8 i;
i++;
i++;
}
void k3()
{
u8 i;
i++;
i++;
}
void k4()
{
u8 i;
i++;
i++;
}
const FunTypeDef funBuf[]=
{
(void*)k1,"void k1()",
(void*)k2,"void k2()",
(void*)k3,"void k3()",
(void*)k4,"void k4()",
} ;
char *sss="void k4()";
#define len sizeof(funBuf)/sizeof(FunTypeDef)
void main()
{
u8 i;
for(i=0;i<len;i++)
{
if(strstr(sss,funBuf.str)!=NULL)
{
(*(void(*)(void))funBuf.fun)();
}
}
while(1)
{
}
}[/mw_shl_code]
求大神解释一下这句: (*(void(*)(void))funBuf.fun)();
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>