#include <stdio.h>
#include<stdlib.h>
#define LIST.H onus;
int main ()
{
char *p,*s;
printf(" LIST.H ");
}
I expect LIST.H to print onus as out put.
But this does not happen.
upon compiling I get a warning
temp.c:3:13: warning: missing whitespace after the macro name
and the output is LIST.H not onus.
How can I get desired thing printed by the above macro?
UPDATE
I want to have the output
as onus with one space before and after the string.
Macros names cannot have
.inside them. That’s why you get the warning:warning: missing whitespace after the macro name, afterLISTit expects a space, but it gets a.instead.Also, when a macro name is inside a string(between
"string") it is not replaced by the macro definition.You could do this instead:
which the preprocessor will transform to:
If you do:
the preprocessor will transform it to:
which won’t compile.