+ 1

I m Confused totally .....

#define sqr(x) x*x int main() { printf("%d",sqr(3+1)); } And the output is 7.....But,How 🤔

1st Nov 2019, 6:30 PM
Sanjeev Kumar
Sanjeev Kumar - avatar
7 Answers
+ 11
Yes, better define it with brackets to cover all cases: #define sqr(x) ((x)*(x)) See this detailed description for more information: https://code.sololearn.com/c80ech3GBNvc/?ref=app
1st Nov 2019, 7:43 PM
Matthias
Matthias - avatar
+ 2
Use printf("%d" , sqr((3+1))) Or #define sqr(x) (x)*(x)
2nd Nov 2019, 1:18 AM
Dev Pratap
Dev Pratap - avatar
+ 2
Just coded it. This will be a clear example feel free to cheak. https://code.sololearn.com/cpG705GY10iq/?ref=app
2nd Nov 2019, 8:14 PM
Walid Al Hasan
Walid Al Hasan - avatar
0
I m Confused totally ..... #define sqr(x) x*x int main() { printf("%d",sqr(3+1)); } And the output is 7.....But,How 🤔
13th Jun 2020, 10:07 AM
Qasim
Qasim - avatar
0
ثيتلذبعغاتقغشقلتسسفغسفيفعيغهيفعيفانمتذيفتبغنهيفهانيفعيفعينالتسساتيفسغانغيسانبفعسغبنغبغبغسلتتلطللتتييطثقتيققفسقسفلنايفعفغ تختبغهبغهبغهبسفعخغهبغهبغغبههغبغنبفعثقسيفبغبهبغه
13th Jun 2020, 10:08 AM
Qasim
Qasim - avatar