static
来源:互联网 发布:亦何为而非天下之公乎 编辑:程序博客网 时间:2024/06/05 05:24
int sum(int a)
{
auto int c=0;
static int b=3;
c+=1;
b+=2;
return(a+b+c);
}
void main()
{
int I;
int a=2;
for(I=0;I <5;I++)
{
printf(“%d,”, sum(a));
}
}
答:8,10,12,14,16 该题比较简单。只要注意b声明为static静态全局变量,其值在下次调用时是可以保持住原来的赋值的就可以。
0 0
- static
- static
- static{}
- static
- static
- Static
- static
- static
- Static
- static
- static
- static
- static
- static
- static
- static
- static
- static
- Quartz以及代码实现--可以实现定时器效果
- Word Pattern
- java连接Sql server 2008步骤
- LeetCode-344 Reverse String
- eclipse将一段代码抽取为方法Extract Method
- static
- Spring web mvc DispatcherServlet (1)---配置
- 第13期 《与这世界交手》16年5月刊
- [Android] android.app.Activity.findViewById(int) on a null object reference
- 异常典型编程题
- JavaScript---网络编程(4)-Date、Math、Global和自定义对象
- 向下转型
- Python 多进程/多线程 学习笔记
- POJ 2406 Power Strings