知识点1 宏常量
宏常量:指用一个标识符号代表的一个常量
#define 标识符 字符串
#define pi 3.14159就将所有的pi 用3.14159代替了。
#include#define PI 3.14159 #define r 3 int main() { printf("area=%f",PI*r*r); return 0 ; }
上面这串代码用PI代替了3.14159.
知识点2 增减运算符
(1)增1运算符
++x: x=x+1; x++ : x=x+1;
( 2)减一运算符
--x :x=x-1; x-- : x=x-1;
今日程序:
#include#include int main() { int a,b,c; scanf("%d %d",&a,&b); c=a-b; int d =abs(c); printf("%d",d); return 0; }
输出:
10 8 2 -------------------------------- Process exited after 4.913 seconds with return value 0 请按任意键继续. . .
今日心得:PTA中的每日一练我懂得了更多的C语言知识,会写简单的程序,C语言真的很奇妙。



