Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/svn/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 指向向量 #包括 #包括 使用名称空间std; int main() { 向量qwerty; qwerty.推回(5); 向量*p=&qwerty; cout//或者 cout_C++_Pointers_Vector - Fatal编程技术网

C++ 指向向量 #包括 #包括 使用名称空间std; int main() { 向量qwerty; qwerty.推回(5); 向量*p=&qwerty; cout//或者 cout

C++ 指向向量 #包括 #包括 使用名称空间std; int main() { 向量qwerty; qwerty.推回(5); 向量*p=&qwerty; cout//或者 cout,c++,pointers,vector,C++,Pointers,Vector,您的“cout”行相当于: // either cout << (*p)[0]; // or cout << p->operator[](0); cout为了更好地理解“p[0]”的含义,您可以尝试以下语句: cout << qwerty; 不能简单回答:不要使用指针。指针存在于C++中是为了服务于特定的目的。不要在不必要的时候使用它们。是的,这只是一个非常简化的示例,旨在传达我遇到的问题。它不是为了反映我正在处理的实际实现。 cout <&l

您的“cout”行相当于:

// either
cout << (*p)[0];
// or
cout << p->operator[](0);

cout为了更好地理解“p[0]”的含义,您可以尝试以下语句:

cout << qwerty;

不能简单回答:不要使用指针。指针存在于C++中是为了服务于特定的目的。不要在不必要的时候使用它们。是的,这只是一个非常简化的示例,旨在传达我遇到的问题。它不是为了反映我正在处理的实际实现。
cout << qwerty;
cout << p[0][0];