/
*copyright (c)2014,烟台大学计算机学院
*All rights reserved
*文件名称:123.cpp
*作者:孙春红
*完成日期:2014年12月7日
*版本号:v1.0
*
*问题描述:阅读下面程序,自己写出运行结果,然后与运行结果进行对比。
*输入描述:略。
*程序输出:略。
*/
#include <iostream>
using namespace std;
int *p;
void pp(int a, int *b);
int main()
{
int a=1, b=2, c=3;
p=&b;
pp(a+c, &b);
cout<<"(2)"<<a<<','<<b<<','<<*p<<endl;
return 0;
}
void pp(int a, int *b)
{
int c=4;
*p=*b+c;
a=*p-c;
cout<<"(1)"<<a<<','<<*b<<','<<*p<<endl;
}
运行结果:
知识点总结:
运用函数的调用进行指针的运行。