C++Review9_指针

时间:2020-02-24 17:20:34   收藏:0   阅读:62
#include <iostream>

using namespace std;

int main() {
    int * p;
    int a = 5;
    p = &a;
    cout<<"sizeof a is "<<sizeof(a)<<endl;
    cout<<"sizeof p is "<<sizeof(p)<<endl;
    cout<<"&a is       "<<&a<<endl;
    cout<<"p is        "<<p<<endl;
    cout<<"a is        "<<a<<endl;
    cout<<"*p is       "<<*p<<endl;
    cout<<"&p is       "<<&p<<endl;

    *p = 6;
    cout<<"After opration  *p = 6"<<endl;
    cout<<"a is        "<<a<<endl;
    cout<<"*p is       "<<*p<<endl;
    return 0;
}

技术分享图片

 

原文:https://www.cnblogs.com/grooovvve/p/12357449.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!