摘要: 在程序运行过程中,其值不能被改变的量成为常量。下面是符号常量的例子:1 #include <stdio.h>2 #define PRICE 30 //符号常量3 void main()4 {5 int num,total;6 num = 10;7 total = num * PRICE;8 printf("total= %d\n",total);9 }同样的,我们汇编代码瞅瞅 1 00401010 >|> \55 push ebp 2 00401011 |. 8BEC mov ebp, esp 3 ... 阅读全文
posted @ 2012-05-03 22:31 r3call 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 第四题:进行输出打印1 #include <stdio.h>2 3 void main()4 {5 printf("*****************************\n");6 printf("\tVery good!\t\t\n");7 printf("*****************************\n");8 }第五题:输入a,b,c三个值,输出其中最大者。 1 #include <stdio.h> 2 3 void main() 4 { 5 int max(int x,int y); 阅读全文
posted @ 2012-05-03 21:40 r3call 阅读(208) 评论(0) 推荐(0) 编辑
摘要: 子函数,就像小弟一样,帮我做各种各样的事 1 #include <stdio.h> 2 3 void main() 4 { 5 int max(int x,int y); //函数的声明 6 int a,b,c; 7 scanf("%d,%d",&a,&b); //获取输入 8 c=max(a,b); //调用子函数 9 printf("max= %d \n",c);10 }11 12 int max(int x,int y)13 {14 int z;15 if(x>y)16 {17 z... 阅读全文
posted @ 2012-05-03 21:25 r3call 阅读(313) 评论(0) 推荐(0) 编辑
摘要: 求两个整数之和,也是一个很小的程序,但是其中的道理,还是很多的,我们要好好体会。相加的两个数从哪来,到哪去? 1 #include <stdio.h> 2 3 void main() 4 { 5 int a,b,sum; 6 a=123; 7 b=456; 8 sum=a+b; 9 printf("sum is %d \n",sum);10 }工程下载地址:http://files.cnblogs.com/tk091/rl002.zip同样的,我们我OD来查看对应的汇编代码:00401010 > 55 push ebp004... 阅读全文
posted @ 2012-05-03 20:49 r3call 阅读(691) 评论(0) 推荐(0) 编辑
摘要: Hello world是最简单的c语言程序,也是大多数程序员的开始。1 #include <stdio.h>2 3 void main()4 {5 printf("Hello World ! \n");6 }对应的工程下载:http://files.cnblogs.com/tk091/rl001.7z我们用OD对其进行反汇编查看(查看的是主函数): 1 00401010 |> \55 push ebp 2 00401011 |. 8BEC mov ebp,esp 3 00401013 |. 83EC 40 sub esp,0... 阅读全文
posted @ 2012-05-03 20:17 r3call 阅读(191) 评论(0) 推荐(0) 编辑