1、宏定义的一般形式为:
宏定义: #define 标识符 常量 //注意:没有分号 终止宏: #undef 标识符
3、程序举例
1 #include<stdio.h> 2 #define pi 3.14 3 int main() 4 {
5 float r=1.0; 6 float area=pi*r*r; 7 printf("the area of the circle is %f",area); 8 return 0; 9 }
结果:
the area of the circle is 3.
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/218874.html原文链接:https://javaforall.net
