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)();