Multiple conditions in a C 'for' loop

前端 未结 7 2151
一整个雨季
一整个雨季 2020-12-15 04:19

I came across this piece of code. I generally use \'&&\' or \'||\' to separate multiple conditions in a for loop, but this code uses commas to do that.<

7条回答
  •  悲哀的现实
    2020-12-15 04:37

    Wikipedia tells what comma operator does:

    "In the C and C++ programming languages, the comma operator (represented by the token ,) is a binary operator that evaluates its first operand and discards the result, and then evaluates the second operand and returns this value (and type)."

提交回复
热议问题