In C, is it guaranteed that 1/2 == 0? [duplicate]

跟風遠走 提交于 2019-12-02 08:37:31

Yes, this is guaranteed. According to the C ISO spec, §6.5.5/5:

The result of the / operator is the quotient from the division of the first operand by the second;

The quotient of 1 / 2 is 0, so 1 / 2 == 0 is guaranteed to be true in C.

Hope this helps!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!