/*
* Copyright (c) 2014, 烟台大学计算机学院
* All rights reserved.
* 文件名称:test.cpp
* 作 者:刘畅
* 完成日期:2014 年 12 月 3 日
* 版 本 号: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;
}
运行结果:
通过单步调试,理解了指针的作用,也加强了对单步调试的应用