title: How to pass a function as a parameter to a function macro in C++
body: <p>I'm following a C++ tutorial from here -  <a href="http://www.cplusplus.com/doc/tutorial/preprocessor/" rel="nofollow noreferrer">http://www.cplusplus.com/doc/tutorial/preprocessor/</a> to learn about <strong>Preprocessor directives</strong>. </p>
  
  <p>So, I tried to write a simple function macro that would accept a function name as a parameter and define the function but I don't seem to find any example on how to do so.</p>
  
  <p>My attempt is as below:</p>
  
  <pre><code>#include&lt;iostream&gt;
  using namespace std;
  
  #define FUNCTION_WRAPPER(function) function(int arg1, int arg2) { cout &lt;&lt; arg1 * arg2; }
  
  FUNCTION_WRAPPER(multiply);
  
  int main() {
      multiply(1, 2);
      return 0;
  }
  </code></pre>
  
  <p><strong>Output</strong></p>
  
  <blockquote>
    <p>C++ requires a type specifier for all declarations.</p>
  </blockquote>