07-27-2023, 11:20 AM
I need a macro which helps to output the given parameter's name and value. It's something like the following code.
#define AA "Hello"
#define BB "World"
#define PRINT(input_param) printf("input_param: %s\n", (input_param))
void main()
{
PRINT(AA);
PRINT(BB);
}
I'm expecting the result: `AA: Hello\n BB: World\n`
But obviously it's not.
Anybody can correct me? Thanks.
#define AA "Hello"
#define BB "World"
#define PRINT(input_param) printf("input_param: %s\n", (input_param))
void main()
{
PRINT(AA);
PRINT(BB);
}
I'm expecting the result: `AA: Hello\n BB: World\n`
But obviously it's not.
Anybody can correct me? Thanks.