2.1 函数声明
float *g(); // indicate a function returning a pointer to a float
float (*h)();//indicate a pointer to a function returning a float
*h是一个float类型的函数,h是指向这个函数的指针
float是类型声明,说明后面的类型是float类型的
g()中,()表示函数调用
类型转换符((*h)())表示“指向返回浮点类型的函数的指针”类型转换符
Q:调用首地址为0位置的子例程
(*0)();但是*必须要一个指向函数的指针作为操作数,所以增加格式转换,
扩充为(*(void (*)())0)();
eg:
void(*)() // indicates a pointer to a function returning nothing
((void(*)())0) //change the type of 0 from integer to a pointer
(*((void(*)())0)) //obtain the data pointed by the pointer, that is the subroutine in location 0
(*((void(*)())0))(); // call the subroutine
3) define a type for a function pointer
typedef float(*ptr)();