/*
* Copyright (c) 2014, 烟台大学计算机学院
* All rights reserved.
* 文件名称:test.cpp
* 作 者:阿里木·阿布都热合曼
* 完成日期:2014年 12 月 9日
* 版 本 号:v1.0
*
* 问题描述:下面是一段使用了指针的程序。请利用“单步”执行的方式运行程序,深刻理解“指针变量存储的是地址值”、“通过指针变量间接访问”等概念。
* 输入描述:
* 程序输出:
*/
#include<iostream>
using namespace std;
int main()
{
int a=2, b=3, c[5]= {1,2,3,4,5};
int *p1, *p2, *p3;
p1=&a;
p2=&b;
p3=c;
p3++;
(*p3)+=10;
cout<<a<<'\t'<<b<<'\t'<<c[1]<<endl;
cout<<*p1<<'\t'<<*p2<<'\t'<<*p3<<endl;
return 0;
}
运行过程: