不好意思,刚才搞错了.看下面的:
来个个形式化定义:
如果a的值是地址(pointer to object ),b为enumeration或integral类型,那么a[b]和b[a]都等价于*(a+sizeof(*a)*b).
a和b哪个是pointer to object type and pointer to what type 哪个是integer type编译器知道.
PS: C定义字符串常量类型为char *
Array subscripting :
One of the expressions shall have type ‘‘pointer to object type’’, the other expression shall have integer type, and the result has type ‘‘type’’.
One of the expressions shall have type ‘‘pointer to object type’’, the other expression shall have integer type, and the result has type ‘‘type’’.
来个个形式化定义:
如果a的值是地址(pointer to object ),b为enumeration或integral类型,那么a[b]和b[a]都等价于*(a+sizeof(*a)*b).
a和b哪个是pointer to object type and pointer to what type 哪个是integer type编译器知道.
PS: C定义字符串常量类型为char *
[此贴子已经被作者于2007-6-18 2:21:26编辑过]