c语言 int *p,请教大家怎么理解int *p[3]?

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

ISO C11(N1570)

6.7.6 Declarators

Syntax

1 declarator:

pointeropt direct-declarator

direct-declarator:

identifier

( declarator )

direct-declarator [ type-qualifier-listopt assignment-expressionopt ]

direct-declarator [ static type-qualifier-listopt assignment-expression ]

direct-declarator [ type-qualifier-list static assignment-expression ]

direct-declarator [ type-qualifier-listopt * ]

direct-declarator ( parameter-type-list )

direct-declarator ( identifier-listopt )

pointer:

* type-qualifier-listopt

* type-qualifier-listopt pointer

type-qualifier-list:

type-qualifier

type-qualifier-list type-qualifier

parameter-type-list:

parameter-list

parameter-list , ...

parameter-list:

parameter-declaration

parameter-list , parameter-declaration

parameter-declaration:

declaration-specifiers declarator

declaration-specifiers abstract-declaratoropt

identifier-list:

identifier

identifier-list , identifier

Semantics

2 Each declarator declares one identifier, and asserts that when an operand of the same form as the declarator appears in an expression, it designates a function or object with the scope, storage duration, and type indicated by the declaration specifiers.

3 Afull declarator is a declarator that is not part of another declarator. The end of a full declarator is a sequence point. If, in the nested sequence of declarators in a full

declarator, there is a declarator specifying a variable length array type, the type specified by the full declarator is said to be variably modified. Furthermore, any type derived by declarator type derivation from a variably modified type is itself variably modified.

4 In the following subclauses, consider a declaration

T D1

where T contains the declaration specifiers that specify a type T (such as int) and D1 is a declarator that contains an identifier ident. The type specified for the identifier ident in the various forms of declarator is described inductively using this notation.

5 If, in the declaration ‘‘T D1’’, D1 has the form

identifier then the type specified for ident is T.

6 If, in the declaration ‘‘T D1’’, D1 has the form

( D )

then ident has the type specified by the declaration ‘‘T D’’. Thus, a declarator in

parentheses is identical to the unparenthesized declarator, but the binding of complicated declarators may be altered by parentheses.

注意这里的[]和*以及()是明白地出现在语法中的不属于操作符的组成要素。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值