c - `strcmp` 的返回值的顺序是什么?

标签 c string strcmp

我的代码量非常少:

int test = strcmp("Websecurity", "easily");
printf("%d\n", test);

结果是-1。为什么?显然 'W' 大于 'e'?

最佳答案

在 ASCII 中大写字母排在小写字母之前,所以 'W' < 'e' .

关于c - `strcmp` 的返回值的顺序是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28332788/

相关文章:

抛硬币程序无法运行 Visual Studio 2010

c - C语言任务提醒程序

c - 为什么 struct 给出错误的 sizeof 和 void 指针

string - 如何将一个字符串分割成n个长度的子字符串?

c - C 中的 strcmp() 函数

c - pthread 编程中的共享数据

string - 从给定字符生成固定长度的随机字符串的最 Pythonic 方式

C 以十六进制值初始化数组

c - 'target_tweet'的地址永远不会是NULL!?

在链表上使用 strcmp 进行比较