1 #include2 #include 3 #define PR(n,...) printf("MSG"#n":"__VA_ARGS__) 4 5 int main(void) 6 { 7 double x = 48; 8 double y; 9 10 y = sqrt(x);11 PR(1,"x = %.2lf\n",x);12 PR(2,"x = %.2lf , y = %.4lf\n",x,y);13 14 return 0;15 }
gcc -E va.c
1 # 5 "va.c" 2 int main(void) 3 { 4 double x = 48; 5 double y; 6 7 y = sqrt(x); 8 printf("MSG""1"":""x = %.2lf\n",x); 9 printf("MSG""2"":""x = %.2lf , y = %.4lf\n",x,y);10 11 return 0;12 }
结果:
MSG1:x = 48.00MSG2:x = 48.00 , y = 6.9282