가능한 중복 :
C에서
C pointer to array/array of pointers disambiguationC에서 *와 []가 가장 강한 바인딩?
가 int *thing[5]
각 다섯 개 정수 배열의 정수, 또는 포인터를 가리키는 다섯 포인터 배열입니까?
가능한 중복 :
C에서
C pointer to array/array of pointers disambiguationC에서 *와 []가 가장 강한 바인딩?
가 int *thing[5]
각 다섯 개 정수 배열의 정수, 또는 포인터를 가리키는 다섯 포인터 배열입니까?
[]
C precedence table 당 *
즉, 5 개의 int 포인터 배열을 가지고 있음을 의미합니다.
어쩌면 중복입니다 ... 정수에 대한 5 개의 포인터 배열입니다. 비슷한 질문에 인용 된 프로그램 cdecl
는 초보자를 위해 유용 할 수 있습니다 :
cdecl> explain int *t[5];
declare t as array 5 of pointer to int
의심 사용 괄호 안의 경우 - 유지 보수 프로그래머가 당신을 감사합니다
결석 그래서
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 * ]
- INT 어레이 (5)에 대한 포인터> 선언 일 은'cdecl 규칙> INT (* 일) [5] 설명 ' 이것은 그가 물었던 5 개의 정수 배열에 대한 포인터를 제공합니다. –