#include <stdio.h> #define PI 3.1415926 //结尾不需要分号 #define area(r) (PI*(r)*(r)) //整体带括号,内部变量带括号 注意:macro中的变量是没有类型的 int main() { double radius; printf("input a radius: "); scanf("%lf", &radius); if (radius < 0) { //printf("radius can't be negative.\n"); puts("radius can't be negative."); } else { printf("The area of a circle with a %f radius is %f\n", radius, area(radius)); } }