C/C++ static全局变量和static局部变量
来源:互联网 发布:淘宝足球鞋便宜 编辑:程序博客网 时间:2024/06/08 20:05
1.static全局变量不能被其他源文件通过extern进行引用访问。
//1.cstatic int x;
//2.c#include <stdio.h>extern int x;void main(){printf("%d\n",x);}
2.static局部变量的值在函数执行完毕,仍然可以保留下来。
#include <stdio.h>void disp(){static int x;printf("%d\n",x++);}void main(){disp();disp();}
结果是0,1
0 0
- C/C++ static全局变量和static局部变量
- C语言 const static 静态变量 全局变量 局部变量
- c语言中的全局变量,局部变量,static,extern
- C++——static关键字(全局变量,局部变量,函数)
- C-C++中static的用法全局变量与局部变量
- C语言中局部变量和全局变量变量的存储类别(static,extern,auto,register)
- C语言中局部变量和全局变量变量的存储类别(static,extern,auto,register)
- 黑马程序员——c语言的全局变量和局部变量,static和extern,预处理指令
- C语言中局部变量和全局变量的存储类别(static,extern,auto,register)
- 局部变量和全局变量,extern和static
- 【C语言】局部变量、全局变量,局部静态变量,全局静态变量,extern,static的区别
- static修饰的全局变量和局部变量
- static变量,全局变量,局部变量
- static作用(修饰函数、局部变量、全局变量) C/C++中static关键字详解
- 普通局部变量、普通全局变量、static局部变量、static全局变量
- c 语言 : 局部变量 、全局变量、static变量 register变量 总结(更新)
- static 全局变量 局部变量 函数
- static全局变量、局部变量、函数
- 求十亿个数的平均数的方法
- 【黑马程序员】----Java之 常用工具类整理
- U3D是大坑!!!!!
- 加快MySQL逻辑恢复速度的方法和参数总结
- IT毕业生职业发展指导手册
- C/C++ static全局变量和static局部变量
- ok,do a new thing
- python模块学习--python正则表达式处理模块re
- 在visual studio 2013下使用bison+flex工具
- Hive中分组取前N个值
- discuz!二次开发笔记
- 错误:HttpServlet was not found on the Java
- 安装SQLServer2012后,80端口被占用
- MYSQL数据丢失讨论