代码:
#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;
}
运行结果:
学习心得:
通过这个程序,真正了解了 指针 的作用,要小心使用就对了!!