2010-06-24 3 views

답변

7

[]C precedence table* 즉, 5 개의 int 포인터 배열을 가지고 있음을 의미합니다.

4

어쩌면 중복입니다 ... 정수에 대한 5 개의 포인터 배열입니다. 비슷한 질문에 인용 된 프로그램 cdecl는 초보자를 위해 유용 할 수 있습니다 :

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

- INT 어레이 (5)에 대한 포인터> 선언 일 은'cdecl 규칙> INT (* 일) [5] 설명 ' 이것은 그가 물었던 5 개의 정수 배열에 대한 포인터를 제공합니다. –

6

의심 사용 괄호 안의 경우 - 유지 보수 프로그래머가 당신을 감사합니다

0
(당신이 마지막으로 버그를 발견 할 때 5am에 당신으로!)

결석 그래서

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 
이 문법을 따른다

괄호 명시 그룹 모두 배열 첨자 [] 연산자와 함수 호출 연산자 () 결합 전에 * (취 . N 하비 슨 & 스틸, 5 ED 부록 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 * ] 
관련 문제