Intel Corporation Interview Question

given #define A 2 + 3 #define B 2 printf("%d", A * B) what does this print?

Interview Answers

Anonymous

Jul 13, 2010

8

9

Anonymous

Oct 27, 2010

Preprocessor replaces A and B and then operator * has precedence over +

5

Anonymous

Apr 6, 2015

It's never a good idea to obscure the precedence... I'd require the 'A' to be wrapped like this: #define A (2+3) This will result in what is more likely the expected answer.

1