#include <stdio.h> #define sqr(x) x*x int main() { printf("%d",sqr(3+1)); return 0; } | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

#include <stdio.h> #define sqr(x) x*x int main() { printf("%d",sqr(3+1)); return 0; }

Can any one explain this C program?

17th Sep 2020, 11:20 AM
Shaktirajsinh zala
Shaktirajsinh zala - avatar
2 Answers
+ 18
Output: 7 Here's how: #define sqr(x) x*x Here value of x = (3+1) the thing we are passing on sqrt() as parameters. x = 3+1 So it will executed like this: x*x 3+1*3+1 3+3+1 //using operator precedence.. 7 I hope u understand Happy Coding 💕💕
17th Sep 2020, 11:25 AM
Aakaanksha 💕 [TheBraveCoders]
Aakaanksha 💕 [TheBraveCoders] - avatar
+ 1
Thank you
11th Oct 2021, 1:56 PM
Abdelouafi Sidane
Abdelouafi Sidane - avatar