2015-05-04 49 views
0
#define IAP_LOCATION 0X1F00FFFF 

int iap_program(unsigned int target_addr, unsigned int source_addr) 
{ 
    typedef void(*IAP)(unsigned int[], unsigned int[]); 
    IAP iap_entry; 

    iap_entry = (IAP) IAP_LOCATION; 

    command[0] = 50;        // prepare the sector for write operation 
    command[1] = 7;        // start sector no 
    command[2] = 7;        // end sector no 
    iap_entry (command, result); 
} 

在上面的代碼我感到困惑的線IAP iap_entry; IAP是一個函數pointer.What不IAP iap_entry和iap_entry =(IAP)IAP_LOCATION;意思?質疑約指向一個函數

我習慣在下面

float funct(float num1, float num2) 
{ 
    return num1 * num2; 
} 

typedef float(*pt2Func)(float, float); 

pt2Func *FnPtr = &funct; 

float result = (*FnPtr)(2.0, 5.1); 
} 

回答

0

IAP給出的風格使用函數指針是函數指針。它是一個功能指針類型。 (在相同的方式,int是數字型,而不是一個號碼本身)

iap_entry一個函數指針,IAP類型。

(IAP) IAP_LOCATION也是一個函數指針,類型爲IAP,它是通過將一個整數轉換爲一個指針產生的。