How does an equal to expression work in a printf placeholder? [duplicate]
问题 This question already has answers here : Why are these constructs using pre and post-increment undefined behavior? (14 answers) Closed last year . I have the following code snippet: main( ) { int k = 35 ; printf ( "\n%d %d %d", k == 35, k = 50, k > 40 ) ; } which produces the following output 0 50 0 I'm not sure I understand how the first value of the printf comes to 0 . When the value of k is compared with 35 , it should ideally return (and thus print) 1, but how is it printing zero? The