[Solved] #define OUTPUT(j) count++ what does this do?


The preprocessor directive

#define OUTPUT(j) count++

makes the preprocessor to replace every occurrence of OUTPUT(j) with count++ where j is variable and can be used in the patter part of the directive.

The code

#define OUTPUT(j) count++

int count(4);
OUTPUT(1234);
std::cout << count << '\n';

is translated to

int count(4);
count++;
std::cout << count << '\n';

by the preprocessor and then compiled by the compiler.

The output of this code is 5. The argument is ignored since j is not used.

solved #define OUTPUT(j) count++ what does this do?