1 1 vote #include<stdio.h> #define CUBE(x) (x*x*x) int main() { int a, b=3; a = CUBE(b++); printf("%d, %d ", a, b); return 0; } Why this give 27,6 as output? Programming in C programming-in-c undefined-behaviour non-gatecse + – komal07 1.4k views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
Best answer 2 2 votes Undefined Behavior. Compile with gcc with the following command : gcc filename.c -save-temps Now look intro your directory where you have saved this c file. Open the filename.i file. It would be large preprocessed file. Go to the end of the file and there you can see how your macros are being replaced with b++. a = (b++*b++*b++); This creates undefined behaviour. You can execute your program here: http://codepad.org/ Output:27,6 http://ideone.com/ Output:60,6 https://gateoverflow.in/62411/what-is-the-output dd answered Aug 18, 2016 • selected Aug 18, 2016 by ManojK dd comment Share Follow 0 reply Please log in or register to add a comment.