首先定义一个链表
typedef struct Lianbiao
{
struct Lianbiao *next;
bool (*pFUNC)(u4,void*,void*)
...........
}
声明下链表
Lianbiao caonima[256];
int index = 0; 这个事链表的索引,表示到哪个链表了;
然后写链表函数
void lianbiaohanshu()
{
Lianbiao *pTBL;
if(index == 256)//表示到头了
{
return ;
}
pTBL=&caonima[index];
.......赋值操作
if(index)
{
pTBL = &caonima[index-1];
pTBL->next=&caonima[index]; 上一表的next指向本表
}
index++;
}
int (*pFUNC) (int,int)
表示定义了一个指针变量指向函数 int (*)(int ,int )
如让 pFUNC = dealwithapple;
那么调用的时候,(*pFUNC)(a,b)就相当于调用
dealwtihapple(a,b);
两个用在结构体里相当方便;