Be careful when using macros; there’s something wrong with this one – what’s wro
ID: 666906 • Letter: B
Question
Be careful when using macros; there’s something wrong with this one – what’s wrong?
#define intSquare(X) ((int) (X*X)) /* square a float, make int */
A.You can’t use a “#define” to create executable code, only to replace definitions with values.
B.You can’t do a “cast” (change the type) of “X” because it may already be “int”.
C.The placeholder “X” is only shown once in the “#define” but twice in the definition. You can’t do that.
D.Passing an expression for “X” can yield strange results because of precedence.
E.It doesn’t have a “;” at the end to terminate the statement. You’ll get an error.
Explanation / Answer
You can’t do a “cast” (change the type) of “X” because it may already be “int”.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.