【发布时间】:2011-07-08 17:21:08
【问题描述】:
【问题讨论】:
-
这个问题不是精确重复的,因为它要求 C++ 并且 C++ 中的内容比 C 中的要多。
【问题讨论】:
没有。但它可以在您需要时衰减为指针。
void foo1(char * c) {
}
int main() {
char Foo[32];
foo1(Foo); // Foo decays to a pointer
char * s = Foo; // Foo decays to a pointer which is assigned to s
}
【讨论】:
没有任何索引的数组名本身就是一个指针。
int a[10];
printf("%d\n",*a); // will print first value
printf("%d\n",*(a+1) ); // will print second value
【讨论】:
sizeof array 是数组的大小,而不是指针的大小。