+ 1

Why the below code is showing the value of x as 16 however it should be 1 similar to the y. Please help me.

#include <stdio.h> #define sqr(x) x*x int main() { int x = 16/sqr(4); int y = 16/16; printf("%d\n",sqr(4)); printf("x=%d\n",x); printf("y=%d\n",y); return 0; }

21st May 2019, 5:46 AM
Gurvinder Singh Maanak
Gurvinder Singh Maanak - avatar
1 Resposta
+ 1
x == 16/sqr(4) == 16/4*4 == 16. y == 16/16 == 1. z == 16/(sqr(4)) == 16/(4*4) == 1.
21st May 2019, 6:00 AM
Diego
Diego - avatar