You can't do it because when the macro is expanded the "arguments" are replaced as is. So your macro when expanded will look like
2 = 2 * 4;
4 = 2 / 4;
2 = 2 / 4;
In other words, you try to assign values to a value, which makes no sense.
One solution is to use variables instead, but the one I recommend is to avoid using preprocessor macros for this to begin with, and instead create an inline
function which does this "properly". Or, you know, just use std::swap
.
Oh and another thing: You say you want to "swap two numbers in preprocessor". That's impossible. The preprocessor doesn't do anyhing, it just replaces the macro invocation with the body of the macro, to create code that the compiler sees and compiles into executable code, so the calculation you do is done at run-time anyway. If you want to do something at compile-time (but not by the preprocessor) then you should look into templates and constexpr
.