1,082 views

1 Answer

Best answer
2 votes
2 votes

#define foo(m,n) "m##n"

it means if you find foo(m,n) the replace it with "m##n"  , but note that it is string constant, therefore m and n are not variables those are characters.

 

i hope you are seeing for following program :

#include <stdio.h>
#define foo(m,n) m##n
int main()
{
    char *xy="pc",x='k',y='l';
    printf("%s",foo(x,y));
    return 0;
}

 

m##n ------- is a preprocessor operator, which makes concatenate m and n but not the values represented by them !

 

after preprocessing, the code looking like as ( only concentrated on the define statement )

#include <stdio.h>
int main()
{
    char *xy="pc",x='k',y='l';
    printf("%s",xy);
    return 0;
}
selected by