标签:include 程序员 cccccc c语言 color
变量使用注意2: #include <stdio.h> /* 1.变量的作用域 从定义变量的那一行代码开始,一直到所在的代码块结束 2.代码块的作用 及时回收不再使用的变量,为了提升性能 */ int test() { int v = 10; return 0; } int main() { { double height = 1.55; height = height + 1;// 1.55+1 printf("height=%f\n", height); //输出值:2.5500000 } int score = 100; { int score = 200; { int score; score = 50; } printf("score=%d\n", score); //输出数值:200 } printf("score=%d\n", score) //输出数值:100 return 0; } 例题: #include <stdio.h> int main() { int a = 20; int score = a + 100; printf("%d\n", score); //输出值:120 { int score = 50; { score = 10; printf("%d\n", score); //输出值:10 } a = 10; } { score = a + 250; int score = 30; printf("%d\n", score); //输出值 30 } printf("%d\n", score); //输出值:260 return 0; }
标签:include 程序员 cccccc c语言 color
原文地址:http://putongren.blog.51cto.com/9086263/1626201