Constructing a string in definition

Construct a string in definition using an earlier specified definition

#define FIRST_DEFINITION "firstDefinition"


The SECOND_DEFINITION will be replaced by firstDefinitionSecondDefinition.

Dynamically construct a string in definition

In this example we will use a macro with arguments and stringification:

#define THIRD_DEFINITION(P1, P2, P3) "thirdDefinition?p1=" #P1 "&p2=" #P2 "&p3=" #P3

THIRD_DEFINITION takes three arguments (P1, P2, and P3). Value of each parameter is stringified and inserted into the resulting string. Using this definition, THIRD_DEFINITION(aaa, bbb, ccc) will be replaced by thirdDefinition?p1=aaa&p2=bbb&p3=ccc