我这里输出的指针不是应该是数组指针的首地址的值吗?
#include<iostream>using namespace std;
int main()
{
int shu[5]={0,1,2,3,4},*p[5];
for(int a=0;a<=4;a++)
{
p[a]=&shu[a];
cout<<*p<<endl;
}
return 0;
}
#include<iostream> using namespace std; int main() { int shu[5]={0,1,2,3,4},*p[5]; for(int a=0;a<=4;a++) { p[a]=&shu[a]; cout<<"数组地址:"; cout<<&shu[a]; cout<<" 元素索引:"; cout<<a; cout<<endl; cout<<"指针数组地址:"; cout<<&*p[a]; cout<<" 元素索引:"; cout<<a; cout<<endl; } return 0; }数组地址:0012FF4C 元素索引:0