定义一个函数式宏diff(x, y),返回x, y的差。
1、
#include <stdio.h> #define diff(x, y) ((x) - (y)) int main(void) { int a, b; puts("please input two integers."); printf("a = "); scanf("%d", &a); printf("b = "); scanf("%d", &b); printf("the diff of a and b is: %d\n\n\n", diff(a, b)); double c, d; puts("please input two real numbers."); printf("c = "); scanf("%lf", &c); printf("d = "); scanf("%lf", &d); printf("the diff of c and d is: %f\n", diff(c, d)); return 0; }