0
(Operator pre: * / %) Why 16?
#include <stdio.h> #define sqr(x) x*x int main() { printf("%d", 16/sqr(4)); return 0; }
2 ответов
+ 2
16/sqr(4) = 16/4*4
Try this:
#define sqr(x) (x*x)
or:
printf("%d", 16/(sqr(4)));
this equal 16/(4*4)
0
16/4*4=16 But, in operator precedence, * first then / then %. Does it should = 1? 16/4*4 => 16/(4*4).