码迷,mamicode.com
首页 > 编程语言 > 详细

C++Review9_指针

时间:2020-02-24 17:08:51      阅读:80      评论:0      收藏:0      [点我收藏+]

标签:image   return   ios   amp   img   after   mamicode   指针   src   

#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;
}

技术图片

 

C++Review9_指针

标签:image   return   ios   amp   img   after   mamicode   指针   src   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!