2010-06-24 17 views

回答

4

也許是重複的......它是一個由五個指向整數的指針組成的數組;在類似的問題中引用的程序cdecl可以爲新手有用:

cdecl> explain int *t[5]; 
declare t as array 5 of pointer to int 
+0

另外: 'CDECL>解釋INT(*東西)[5] - > 聲明東西作爲指針INT的陣列5 ' 這給出了一個他詢問的5個整數的指針。 – 2010-06-24 16:19:48

6

如有疑問,使用括號 - 維護程序員會感謝你

0
(如將您在上午05點,當你終於找到了這個錯誤!)

缺席任何顯式的分組與括號,既有數組下標操作者[]和函數調用操作()綁定之前*,所以

T *a[N];  -- a is an N-element array of pointer to T 
T (*a)[N];  -- a is a pointer to an N-element array of T 

T *f();   -- f is a function returning pointer to T 
T (*f)();  -- f is a pointer to a function returning T 

這從語法如下(取。1.從哈比森&斯蒂爾,第5版,附錄B):

 
declarator: 
    pointer-declarator 
    direct-declarator 

pointer-declarator: 
    pointer direct-declarator 

pointer: 
    * type-qualifier-listopt 
    * type-qualifier-listopt pointer 

direct-declarator: 
    simple-declarator 
    (declarator) 
    function-declarator 
    array-declarator 

function-declarator: 
    direct-declarator (parameter-type-list) 
    direct-declarator (identifier-listopt) 

array-declarator: 
    direct-declarator [ constant-expressionopt ] 
    direct-declarator [ array-qualifier-listopt array-size-expressionopt ]  
    direct-declarator [ array-qualifier-listopt * ] 
相關問題