0

What is the output of the following code?

What is the output of this code? #define sqr(x) x*x int x = 16/sqr(4); printf("%d", x); a.)4 b.)0 c.)1 d.)16 And the answer is given as d.)16 but i dont understand i get the output as 1

4th May 2020, 4:21 AM
Janani
Janani - avatar
3 Respuestas
+ 6
It's a very famous quiz question. For this you should keep in mind that #define allows you to make text substitutions before compiling the program. So the following program can be read like this during the time of compilation:- int x = 16/4 * 4 printf("%d",x) So according to this, output should be 16
4th May 2020, 4:36 AM
Arsenic
Arsenic - avatar
+ 3
o/p : 16 x=(16/4)*4=4*4=16
4th May 2020, 6:25 AM
Keerthy Sivadas
Keerthy Sivadas - avatar
4th May 2020, 4:50 AM
Daljeet Singh
Daljeet Singh - avatar