以下是引用叶纤在2020-3-31 17:55:20的发言:
不可以
#include <iostream>
#include<vector>
using namespace std;
void arraynum()
{ vector <int>myarray{1,2,3,4};
myarray.resize(5);
cout<<&myarray[0]<<" ";
cout<<&myarray[1]<<" ";
cout<<&myarray[2]<<" ";
cout<<&myarray[3]<<" ";
cout<<&myarray[4]<<" ";
}
int main()
{
int num=4;
cout<<&num<<" ";
int **p=#//这里报错
auto tex1= p+1;
auto tex2=p+2;
auto tex3=p+3;
cout<<tex1<<" ";
cout<<tex2;
arraynum();
}
不可以
#include <iostream>
#include<vector>
using namespace std;
void arraynum()
{ vector <int>myarray{1,2,3,4};
myarray.resize(5);
cout<<&myarray[0]<<" ";
cout<<&myarray[1]<<" ";
cout<<&myarray[2]<<" ";
cout<<&myarray[3]<<" ";
cout<<&myarray[4]<<" ";
}
int main()
{
int num=4;
cout<<&num<<" ";
int **p=#//这里报错
auto tex1= p+1;
auto tex2=p+2;
auto tex3=p+3;
cout<<tex1<<" ";
cout<<tex2;
arraynum();
}
全部加一个*
你对全部有什么误解
既然 p 你加了 *
num也得加*
https://zh.