可能性の重複:
C: differences between pointer and arrayC++ - 配列はポインタですか?
はpointer
C++
でarray
ですか?これを明確にすることはできますか?
ありがとうございました。
可能性の重複:
C: differences between pointer and arrayC++ - 配列はポインタですか?
はpointer
C++
でarray
ですか?これを明確にすることはできますか?
ありがとうございました。
インデックスのない配列名自体がポインタです。
int a[10];
printf("%d\n",*a); // will print first value
printf("%d\n",*(a+1)); // will print second value
よりもC++でそれによりがあります。この質問はC++にタグ付けされていますが、C++にはテンプレートがあり、それを置き換えるときは問題ありません。 –
'sizeof array'は配列のサイズであり、ポインタのサイズではありません。 – fredoverflow
いいえ。ただし、必要なときにいつでもポインタに崩壊する可能性があります。
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
}
いや、それはないですが、それ自動変換一つにこの質問は、それはC++を要求するよう**正確**重複していないとC. –