经典C语言程序设计100例(4)
【程序41】
标题:学习静态变量的用法
1。程序分析:
2。程序源代码:
# include " stdio . h "
var func()
{
static int static _ var = 0;
printf(":var等于%d \n ",var);
printf(":static var等于%d \n ",static _ var);
printf(" \ n ");
var++;
static _ var++;
}
void main()
{ int I;
for(I = 0;I var func();
}
-。1.程序分析:
2。程序源代码:
# include " stdio . h "
main()
{ int I,num
num = 2;
for(I = 0;I { printf(" \ 40:num等于%d \n ",num);
num++;
{
auto int num = 1;
printf(":内部块编号等于%d \n ",编号);
num++;
}
}
}
0条评论