Pergunta de entrevista da empresa Intel Corporation

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

Respostas da entrevista

Sigiloso

13 de jul. de 2010

8

9

Sigiloso

27 de out. de 2010

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

5

Sigiloso

6 de abr. de 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