C 练习实例41 - static

C 语言教程 · 2019-02-21 22:13:00

题目:学习static定义静态变量的用法。

程序分析:无。

实例

// Created by www.codercto.com on 15/11/9. // Copyright © 2015年 码农教程. All rights reserved. // #include<stdio.h> int main() { void fun(); for(int i=0;i<3;i++) fun(); return 0; } void fun() { int i=0; static int static_i=0; printf("i=%d\n",i); printf("static_i=%d\n",static_i); i++; static_i++; }

以上实例输出结果为:

i=0
static_i=0
i=0
static_i=1
i=0
static_i=2

点击查看所有 C 语言教程 文章: https://codercto.com/courses/l/17.html

查看所有标签

Design for Hackers

Design for Hackers

David Kadavy / Wiley / 2011-10-18 / USD 39.99

Discover the techniques behind beautiful design?by deconstructing designs to understand them The term ?hacker? has been redefined to consist of anyone who has an insatiable curiosity as to how thin......一起来看看 《Design for Hackers》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

html转js在线工具
html转js在线工具

html转js在线工具