Intel Corporation interview question

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

Interview Answers

Anonymous

13 Jul 2010

8

9

Anonymous

27 Oct 2010

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

5

Anonymous

6 Apr 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