Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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”.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote