巨集

define => 就像是 ctrl+h 把左邊全部替換成右邊

原本

/*
 example
*/
#define add(a, b) a + b

int main() {
    printf("%d\n", add(3, 5) * add(3, 5));
}

執行時

/*
 example
*/
#define add(a, b) a + b

int main() {
    printf("%d\n", 3 + 5 * 3 + 5);
}

Last updated

Was this helpful?