【发布时间】:2015-01-31 02:06:43
【问题描述】:
我在我的应用程序中使用了函数指针。但是最近我遇到了一个称为函数指针数组的函数指针。我无法理解它将如何工作。下面是例子,
typedef uint8 (*fnHandlr)( uint16 iD, uint32 Process);
const funHandlr arr[] =
{
fun1, fun2, fun3
}
uint8 fun1(uint16 iD, uint32 Process)
{
/*Piece of code*/
}
uint8 fun3(uint16 iD, uint32 Process)
{
/*Piece of code*/
}
uint8 fun3(uint16 iD, uint32 Process)
{
/*Piece of code*/
}
我的问题如下,
- 这里的typedef有什么用。
- 如果调用了funHandlr,是否会调用数组中的所有函数?
- arr[] 是什么意思。编译器将分配多少字节?
【问题讨论】:
标签: c