C

Asked • 05/19/19

How to make a variadic macro (variable number of arguments)?

I want to write a macro in C that accepts any number of parameters, not a specific numberexample: #define macro( X ) something_complicated( whatever( X ) )where `X` is any number of parametersI need this because `whatever` is overloaded and can be called with 2 or 4 parameters.I tried defining the macro twice, but the second definition overwrote the first one!The compiler I'm working with is g++ (more specifically, mingw)

1 Expert Answer

By:

Patrick B. answered • 05/19/19

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.