Can anybody tell me the way of getting this answer
-
Can anybody tell me the way os getting this answer #define f(g,g2) g##g2 main() { int var12=100; printf("%d",f(var,12))); } Ans:100 Thanks in advance
-
Can anybody tell me the way os getting this answer #define f(g,g2) g##g2 main() { int var12=100; printf("%d",f(var,12))); } Ans:100 Thanks in advance
Upon Preprocessing completion (but before compilation), the statement
printf("%d",f(var,12)))
; gets expanded toprintf("%d",var12))
. So the answer, 100. In macrof(g, g2)
, u r passing var and 12. The statementg##g2
joins the original parameter to the macro i.e,var##12 = var12
. Hence the resulting variable, var12Come online at:- jubinc@skype
-
Can anybody tell me the way os getting this answer #define f(g,g2) g##g2 main() { int var12=100; printf("%d",f(var,12))); } Ans:100 Thanks in advance
Have you considered compiling with the /P switch to see just what the preprocessor resolves the macro to?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne