首页 > 编程语言 > 详细

C语言-自动变量和局部变量

时间:2020-03-01 14:55:57      阅读:82      评论:0      收藏:0      [点我收藏+]

#include <stdio.h>
void auto_static (void)
{
int autoVar = 1;
static int staticVar = 1;
printf ("automatic = %i, static = %i\n", autoVar, staticVar);
++autoVar;
++staticVar;
}
int main (void)
{
int i;
void auto_static (void);
for (i = 0; i < 5; ++i)
auto_static ();

return 0;
}
//输出
//automatic = 1, static = 1
//automatic = 1, static = 2
//automatic = 1, static = 3
//automatic = 1, static = 4
//automatic = 1, static = 5

//--------------------------------
//Process exited after 0.1344 seconds with return value 0
//请按任意键继续. . .

C语言-自动变量和局部变量

原文:https://www.cnblogs.com/Robin5067/p/12389801.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!