c modulus operator

后端 未结 5 434
独厮守ぢ
独厮守ぢ 2021-01-25 13:42

what happens when you use negative operators with %. example -3%2 or 3%-2

5条回答
  •  失恋的感觉
    2021-01-25 13:56

    According to Kernighan & Ritchie, 2nd edition, page 39, 2.5:

    ...the sign of the result for % are machine-dependent for negative operands, as is the action taken on overflow or underflow.

提交回复
热议问题