ch9_9.cpp
资源名称:c.rar [点击查看]
上传用户:puke2000
上传日期:2022-07-25
资源大小:912k
文件大小:0k
源码类别:

C#编程

开发平台:

Visual C++

  1. //*********************
  2. //**    ch9_9.cpp    **
  3. //*********************
  4. #include <iostream.h>
  5. double* fn(const double* pd)
  6. {
  7.   static double ad=32;
  8.   ad+=*pd;
  9.   cout <<"fn being called...the value is: " <<*pd <<endl;
  10.   return &ad;
  11. }
  12. void main()
  13. {
  14.   double a=345.6;
  15.   const double* pa=fn(&a);
  16.   cout <<*pa <<endl;
  17.   a=55.5;
  18.   pa = fn(&a);
  19.   cout <<*pa <<endl;
  20. }