您的位置:首页 > 编程语言

每日编程训练20150909:typedef void (* unitest_func_t) (void);

2015-09-09 23:02 274 查看
#include <stdio.h>
#include <string.h>

typedef void (* unitest_func_t) (void);

typedef struct
{
int id;
unitest_func_t func;
}unitest_t;

void unitest_hello(void)
{
printf("hello unitest!\r\n");
}

const unitest_t unitest_table[] = {

{0,     (void*)0         },
{1,     unitest_hello    },
{0,     (void*)0         },
};

int main(int argc, char* argv[])
{
int i;

printf("hello world!\r\n");

for (i = 0; i < sizeof(unitest_table)/sizeof(unitest_table[0]); i++) {
if (0 != unitest_table[i].id) {
unitest_table[i].func();
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: