A Place for Latest Exam wise Questions, Videos, Previous Year Papers, Study Stuff for MCA Examinations - NIMCET
Previous Year Question (PYQs)
4
What is the output of the following C-program?\n#include\n#define CUBE(x) (x*x*x)\nint main() { int a, b=3; a = CUBE(b++); printf("%d, %d\n", a, b); return 0; }
Solution
Solution:
- Macro expansion: CUBE(b++) → (b++ * b++ * b++).
- This causes multiple side effects → undefined behavior.
- Most compilers treat this as error/undefined. Answer = (D) Error
Online Test Series, Information About Examination, Syllabus, Notification and More.