+ 1

What is the output of this code.

#define sqr(i) i*i main() { printf"%d", sqr(3+1)); } How the output become 7. Please explain it....

1st Mar 2019, 3:30 PM
David Boga
David Boga - avatar
1 Answer
+ 15
David Macro is used to substitute the values in above code snippet so when sqr() function is called then argument inside the function is substitute by defined macro here value of i is replaced by i*i and the value of i=3+1 so it will do like 3+1*3+1=>3+3+1=7 So output become 7
1st Mar 2019, 3:52 PM
GAWEN STEASY
GAWEN STEASY - avatar