MACRO QUERY

T

Tagore

Please consider following program:
-----------------------
#include<stdio.h>
#define TEST ok
int main(void)
{
printf("TEST");
return 0;
}
 
W

WANG Cong

Tagore said:
Please consider following program:
-----------------------
#include<stdio.h>
#define TEST ok
int main(void)
{
printf("TEST");
return 0;
}


Macro replacement only occurs outside of any string literals.
Is there any workaround by which I can print macro expansion of
TEST?

Yes, try:

#define TEST "ok"
printf(TEST);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,159
Latest member
SweetCalmCBDGummies
Top