+ 4

Explaination of this code, anyone?

What is the output of this code? #define macro(r, a, b) b##a##r #define CHAOS macro(r, a, b) void CHAOS(int n) { printf("%d", n); } int main() { bar(4); bar(2); return 0; }

3rd Jan 2019, 6:04 PM
Vijaya Mishra
Vijaya Mishra - avatar
6 Antworten
+ 3
Thank you so much, Rewa Mathur!!
3rd Jan 2019, 6:46 PM
Vijaya Mishra
Vijaya Mishra - avatar
+ 2
What is bar(4) bar(2) meant to be doing here?
3rd Jan 2019, 6:38 PM
Vijaya Mishra
Vijaya Mishra - avatar
+ 2
preyash gothane okay got it!! Thank you!!
3rd Jan 2019, 6:45 PM
Vijaya Mishra
Vijaya Mishra - avatar
+ 1
3rd Jan 2019, 6:29 PM
preyash gothane
preyash gothane - avatar
+ 1
In that link I shared read this "Object-likemacros resemble data objects when used, function-like macros resemble function calls" So those bar are like objects I guess
3rd Jan 2019, 6:41 PM
preyash gothane
preyash gothane - avatar