hi all,
Im a beginner in C. Can you please help me in explaining the function of ## in the below program.

#define f(g,g2) g##g2
main()
{
int var12=100;
printf("%d",f(var,12));
}

what does #define f(g,g2) g##g2 mean?

The ## operator pastes two tokens together (this is why the operation is called the token-pasting operation). In the above code, a function is defined as a macro, which, when given two arguments (var and 12, in our case), forms a single token (in our case, an identifier), var12.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.