C++是数组指针吗?

C++是数组指针吗?,c++,arrays,pointers,C++,Arrays,Pointers,可能重复: 是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 } 不,但只要你需要它,它就会衰减成指针 void foo1(char

可能重复:

是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
}

不,但只要你需要它,它就会衰减成指针

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

没有任何索引的数组名本身就是指针

int a[10];
printf("%d\n",*a); // will print first value
printf("%d\n",*(a+1) ); // will print second value

不,不是,但它会自动转换成一个。这个问题被标记为C++,C++有模板,它在替换时是很重要的。数组的大小是数组的大小,不是指针的大小。不,不是,而是自动转换为一个。这个问题被标记为C++,C++具有模板,当替换为数组时,它是很重要的。数组的大小是数组的大小,这个问题不是精确的重复,因为它要求C++,而且C++中的问题比C.要多。这个问题不是精确的重复,因为它要求C++,C++中的问题比C.多。