34_综合实例
来源:互联网 发布:求职app 知乎 编辑:程序博客网 时间:2024/06/05 21:17
//_34_综合实例//_34_main.cpp//同函数一样,外部变量的定义和外部函数的说明不同//外部变量的定义只有一词,它的位置必须在所有函数之外//而同一文件中的外部变量的说明可以有很多次,位置实在函数之内//(那个函数要用到就在哪个函数中声明)#include <stdio.h>#include <stdlib.h>//声明三个子函数void head1();void head2();void head3();int count=10;//全局变量int main(){register int index;//定义为主函数寄存器变量//在调用变量index时会节省很多时间head1();head2();head3();printf("the value of count is:%d\n",count);for(index=8;index>0;index--){int staff;//局部变量//staff的可见范围只在当前函数体内for(staff=0;staff<=6;staff++)printf("%d ",staff);printf("index is now %d\n",index);}system("pause");return 0;}int counter;//全局变量,可见范围是从定义之处到源程序结尾//三个子函数的的定义void head1(){int index;//局部变量index = 23;printf("the head1 value(index) is %d\n",index);}void head2(){int count;//head2()的局部变量count, //变量名与全局变量重名, //故全局变量count不能呢挂在函数head2中使用count = 53;printf("the head2 value(count) is %d\n",count);counter = 77;}void head3(){printf("the head3 value(counter) is %d\n",counter);}
0 0
- 34_综合实例
- 44_综合实例
- 62_综合实例
- 35_综合实例2
- C语言_综合实例
- 18_有关循环结构的综合实例
- Arduino综合实例之一_避障小车
- 综合实例
- 13_综合技术
- UML综合实例
- ExtJs EditGridPanle 综合实例
- dom修改综合实例
- cookie的综合实例
- 13_JavaWeb综合实例
- java3d综合实例
- HTML表单综合实例
- jquery综合应用实例
- 浮动综合实例练习
- 收藏的链接
- JavaSE 6之脚本引擎让程序如虎添翼
- 2.jQuery UI 简单引入
- error C2137: empty character constant
- 基于Linux的SVN使用说明
- 34_综合实例
- apache kafka源码分析走读-Producer分析
- 递归解Codeforces Round #256 (Div. 2)C. Painting Fence
- 35_综合实例2
- 【线段树】 FZU 2105 Digits Count
- jquery ajax获得list并显示
- Vim-centeros-升级至vim7.4python支持
- 36_变量的指针
- 【ORACLE】ORA-27102: out of memory报错的处理