15周(指针分布)

来源:互联网 发布:修改数据库系统时间 编辑:程序博客网 时间:2024/06/05 00:30

/*
*copyright(c) 2014,烟台大学计算机学院
*All rights reserved。
*文件名称:15周(指针分布)

*作者:王忠
*完成日期:2014.12.10

*版本号: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;}


 

 

0 0
原创粉丝点击