How to use macros with arguments to define compile-time functions in C++

1 Answer

0 votes
#include <iostream>

#define SQUARE(x) ((x)*(x))

int main() {
    int result = SQUARE(4);
    
    std::cout << result;
}




/*
run:

16

*/

 



answered Dec 3, 2022 by avibootz
...