0
How to evaluate the return of (if condition) when using multiple logic operators and integers
While competing with a friend using (c language) here on sololearn, there wa this question: What's the output of this code? If (1 && 1 && 1 || 0) printf("a"); else printf("b"); The solution was "a".. Now I don't know what the condition returned nor why the first was chosen. Can anyone help me understand this?
2 odpowiedzi
+ 3
1 && 1 -> true
true && 1 -> true
true || 0 -> true