每日编程训练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(); } } }
相关文章推荐
- C# 获取SHA256码
- 零基础学python-13.5 多迭代器vs单迭代器
- 零基础学python-13.5 多迭代器vs单迭代器
- java参数传递(值传递还是引用传递)
- Qt自定义事件实现及子线程向主线程传送事件消息(理论+代码)
- C#实现在线更新
- VS2010 debug output not showing up in DbgView
- php高并发状态下文件的读写
- 推荐一篇关于java集合的博文,写的很nice
- Spring-Batch CSV文件读取时的注意点
- java设计模式第4弹--桥接模式
- Java习题2
- Java String与其他类型之间的转化及其算法练习
- 2015/9/9 Python基础(10):文件和输入输出
- ASP.Net MVC开发基础学习笔记(5):区域、模板页与WebAPI初步
- 指针和C++的基本原理
- 冒泡排序和快速排序算法练习
- 启动ie就出现“无法显示此页” 以及 360 浏览器 域名解析错误(错误代码:105) 解决办法
- Django1.8教程重点
- PAT 一元多项式的乘法与加法运算(链表 c++版)