+ 3

Need clarity on " v##a##r "execution?

#include <stdio.h> #include <stdlib.h> #include <string.h> #define macro(r,a,v) v##a##r #define DECVAR macro(r,a,v) int main() { int DECVAR=42; var++; printf("%d",var); return 0; } ans=43

28th Oct 2018, 6:43 AM
Pavithran
Pavithran - avatar
2 Respostas
+ 9
Have you tried checking the comment section of this feed post? In preprocessor commands, ## is concatenation. DECVAR is replaced with macro(r,a,v), which is then replaced with var. 42 is assigned to var, bar is incremented, and then printed. https://www.sololearn.com/post/39626/?ref=app
28th Oct 2018, 8:46 AM
Hatsy Rei
Hatsy Rei - avatar
+ 1
Thanks sir.
28th Oct 2018, 9:14 AM
Pavithran
Pavithran - avatar