静态变量

#include<stdio.h>
void synthesis(void);
int main() {
	int count,number;
	for( count=1,number=1;count<=3,number<=3;count++,number++)
	{
		printf("here is the most %d\n", count);
		synthesis();
	}

}
void synthesis(void) {
	int fade = 1;
	static int stay = 1;//创建一个不变的变量
	printf("%d and %d\n", fade++, stay++);//先用后加
	printf("%d or %d\n", ++fade, ++stay);//先加后用
}

here is the most 1

1 and 1

3 or 3

here is the most 2

1 and 3

3 or 5

here is the most 3

1 and 5

3 or 7

输出答案

全部评论

相关推荐

07-09 18:28
门头沟学院 Java
写着提前批,结果还要实习4个月以上???
程序员牛肉:这种不用看,直接投了,面试的时候问对应的HR就行。有可能他们是直接复制的暑期实习的模板。
点赞 评论 收藏
分享
06-14 19:09
门头沟学院 Java
darius_:给制造业搞的,什么物料管理生产管理,设备管理点检,最最关键的就是一堆报表看板。个人觉得没啥技术含量都是些基本的crud,但是业务很繁琐那种
点赞 评论 收藏
分享
06-02 15:17
门头沟学院 Java
心爱的idea:怎么会呢 应该是打招呼有问题 问就说实习6个月全国可飞随时到岗
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
07-09 12:11
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务