现在的位置: 首页 > 综合 > 正文

高手请留步!!!!

2013年09月21日 ⁄ 综合 ⁄ 共 337字 ⁄ 字号 评论关闭

#include <iostream>

using namespace std;

int main()
{
    int x=9,y=7;
    int const *ptr1=&x;                               (1)
    cout<<*ptr1<<endl;
    ptr1=&y;
    cout<<*ptr1<<endl;
    int * const ptr2=&x;                                (2)
    cout<<*ptr2<<endl;
    ptr2=&y;
    cout<<*ptr2<<endl;
    return 0;
}

小弟我无意间看到了这样一个程序,运行的时候有问题,主要是第(1)行和第(2)行的区别,还请各位大侠指教!

【上篇】
【下篇】

抱歉!评论已关闭.