c/c++语言开发共享验证全局变量的改变

/************************************************** *程序名:test1.cpp *编辑者:鸿灬嗳 *注:验证全局变量的改变。 ***************************************************/ #includ… …

  1. /************************************************** 
  2. 程序名:test1.cpp 
  3. 编辑者:鸿灬嗳 
  4. 注:验证全局变量的改变。 
  5. ***************************************************/  
  6. #include”iostream”  
  7. using namespace std;  
  8. int x=3;  
  9. void verify(void);  
  10. int main()  
  11. {  
  12.     cout<<查看初始化的全局变量x<<x<<endl;  
  13.     static int y=2;  
  14.     cout<<定义静态局部变量y<<y<<endl;  
  15.     cout<<进行x+=y计算!<<endl;  
  16.     x+=y;  
  17.     verify();  
  18.     return 0;  
  19. }  
  20. void verify(void)  
  21. {  
  22.     cout<<查看是否改变全局变量x<<x<<endl;  
  23. }  

本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

ctvol管理联系方式QQ:251552304

本文章地址:https://www.ctvol.com/c-cdevelopment/604725.html

(0)
上一篇 2021年5月12日
下一篇 2021年5月12日

精彩推荐