+ 2

Why this is happening?(see code)

C challenge question.i know that non zero value means true in c.but why the compiler here is assuming condition false .so i predict it would be like it reads from right to left.tell me exactly which things in c work like this and what we call this behaviour. I mean just detail this behaviour. https://code.sololearn.com/cnmC00SDEBxn/?ref=app

11th Dec 2021, 3:29 PM
gaurav kumar
gaurav kumar - avatar
7 Answers
+ 4
I thought you had gotten it figured out https://www.sololearn.com/Discuss/2939340/?ref=app
11th Dec 2021, 4:20 PM
Ipang
+ 3
"while" can have only one boolean argument. In this case, the compiler sees the comma and ignores the first argument until it reaches the closing parenthesis. Thus, only the last argument will be used.
11th Dec 2021, 3:51 PM
Solo
Solo - avatar
+ 3
gaurav kumar the comma operator evaluates from left to right. The rightmost value is zero, therefore the final value of the expression is false.
11th Dec 2021, 6:11 PM
Brian
Brian - avatar
+ 3
Gaurav, Just go ahead and post a new question. TBH Idk how compiler works intermally, but I can say it's pretty complicated that only senior coders may be able to answer such question.
12th Dec 2021, 4:41 AM
Ipang
+ 2
Ipang i want more information.how compiler reads.
12th Dec 2021, 3:33 AM
gaurav kumar
gaurav kumar - avatar
+ 2
12th Dec 2021, 6:02 AM
gaurav kumar
gaurav kumar - avatar
0
how compilor reads 📖the output.
12th Dec 2021, 5:42 AM
Shubham Bhatia
Shubham Bhatia - avatar