Aspire Faculty ID #12649 · Topic: JECA MCA 2024 · Just now
JECA MCA 2024

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

Previous 10 Questions — JECA MCA 2024

Nearest first

Next 10 Questions — JECA MCA 2024

Ascending by ID
Ask Your Question or Put Your Review.

loading...