strcmp() and signed / unsigned chars

徘徊边缘 提交于 2019-12-01 02:29:42

7.21.4/1 (C99), emphasis is mine:

The sign of a nonzero value returned by the comparison functions memcmp, strcmp, and strncmp is determined by the sign of the difference between the values of the first pair of characters (both interpreted as unsigned char) that differ in the objects being compared.

There is something similar in C90.

Note that strcoll() may be more adapted than strcmp() especially if you have character outside the basic character set.

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