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
3 Réponses
+ 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
+ 3
o/p : 16
x=(16/4)*4=4*4=16