理解二级指针的好例子

/*
    Name:
    Copyright:
    Author:  流照君
    Date: 2019/9/22 22:29:36
    Description:
*/
#include <iostream>
#include<string>
#include <algorithm>
#include <vector>
#define inf 0x3f3f3f3f
using namespace std;
typedef long long ll;
void move(int **p,int a[])
{
    cout<<p<<endl;
    *p=&a[1];
    cout<<*p<<endl; 
}
int main(int argc, char** argv)
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    int a[]={1,2,3,4,5};
    int *p=&a[0];
    //p=&a[0];
    cout<<p<<" "<<&a[0]<<endl;
    move(&p,a); 
    cout<<*p<<endl;
    return 0;
}

 

posted @ 2019-09-22 22:53  流照君  阅读(273)  评论(0编辑  收藏  举报