1.07-变量使用注意2
2015-07-27 09:00
204 查看
#include <stdio.h>
/*
1.变量的作用域
从定义变量的那一行代码开始,一直到所在的代码块结束
2.代码块的作用
及时回收不再使用的变量,为了提升性能
*/
int test()
{
int v =
10;
return
0;
}
int main()
{
{
double height =
1.55;
height = height +1;
printf("height=%f\n", height);
}
/*
{
int a = 10;
}
printf("a=%d\n", a);*/
int score =
100;
{
int score =
200;
{
int score;
score =50;
}
printf("score=%d\n", score);
}
printf("score=%d\n", score);
return
0;
}
/*
1.变量的作用域
从定义变量的那一行代码开始,一直到所在的代码块结束
2.代码块的作用
及时回收不再使用的变量,为了提升性能
*/
int test()
{
int v =
10;
return
0;
}
int main()
{
{
double height =
1.55;
height = height +1;
printf("height=%f\n", height);
}
/*
{
int a = 10;
}
printf("a=%d\n", a);*/
int score =
100;
{
int score =
200;
{
int score;
score =50;
}
printf("score=%d\n", score);
}
printf("score=%d\n", score);
return
0;
}
相关文章推荐
- 1.04-注释
- 1.06-变量使用注意
- 1.05-变量
- 04-scanf的其他用法和注意
- 03-scanf小练习
- 02-scanf函数的基本使用
- 2.01-变量的内存分析
- 1.08-变量练习-交换变量的值
- shell版俄罗斯方块一:方向键获取
- shell版俄罗斯方块一:方向键获取 分类: shell版俄罗斯方块 2015-07-27 09:00 114人阅读 评论(0) 收藏
- 一个游戏机的“山寨”创新,靠什么成功
- C 程序结构
- Adb 抓不住Genymotion的解决方法
- 设计模式学习笔记十二:访问者模式
- TestNG监听器实现失败自动截图、重跑、自定义html结果文件功能
- 设计模式学习笔记十二:访问者模式
- 布局文件传入参数
- 有关如何入门ACM