请问怎么理解二级指针和一级指针呢,新手求教
程序代码:
#include<stdio.h> int main() { int value = 5; int *ptr = &value; printf ("%d",*ptr); int **ptrptr = &ptr; printf ("%d",**ptrptr); }
#include <iostream> using namespace std; int main() { int num=4; cout<<&num<<" "; int * p=# cout<<*p; }
#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(); }