+ 7
Doubt (C language , question from challenges)
What is the output? #define sqr(x)x*x int main(){ printf("%d",sqr(3+1)); }
4 ответов
+ 3
Since define just copy and pastes, you have
3+1*3+1 = 3+3+1 = 7
Use
#define sqr(x) ((x)*(x))
to get the intendet behavior
+ 3
Thankyou mimtelf
+ 3
Oh, I didn't notice there are C challenges already 😱
That's nice 😅
You can report wrong answers, then other users won't encounter the same problem in the future hopefully^^
+ 2
This question has the wrong answer (9) in the c challenge.