c - Evaluation of this statement -


i reading c book , don't understand statement asking me evaluate.

here statement, !(1 && !(0 || 1))

i can understand things here... have far, not(1 , not(0 or 1))

so it's not 1 , not 0 or 1? or not 1 , 0 or 1? 2 ! cancel each other out double negative? answer true expected false.

can explain?

  1. (0 || 1) == 1
  2. !1 == 0
  3. 1 && 0 == 0
  4. !0 == 1 known true :)

keep in mind || , && short circuit operators, in case still have evaluate right side because operators not short circuit


Comments

Popular posts from this blog

Issues changing the value of an element in an array in matlab -

php - MySQLi binding parameters in a prepared statement doesn't work unless inserted after "WHERE" -

vb.net - Alternative to the T-SQL AS keyword -