Explain what happens in each of the if tests:
belongs to book: C++ Primer|Stanley B.Lippman, Josee Lajoie, Barbara E.Moo|5th Edition| Chapter number:4| Question number:4.14
All Answers
total answers (1)
belongs to book: C++ Primer|Stanley B.Lippman, Josee Lajoie, Barbara E.Moo|5th Edition| Chapter number:4| Question number:4.14
total answers (1)
`if (42 = i) // ...` is an error.
`if (i = 42) // ...` will first assign 42 to `i` and yield the value of `i` as the condition expression of `if` statement. And because 42 is nonzero, the condition will be `true`.