易百教程

85、下面的 C 程序的输出是什么?

#include <stdio.h>
#include <string.h>
int main(void)
{
    char str[] = "#Yiibai";
    const int ret = strcmp(str,"#yiibai");
    printf("ret = %d
",ret);
    return 0;
}

一个负值。

解释说明:

int strcmp(const char *s1, const char *s2);
strcmp() 返回一个表示比较结果的整数,
如下:
0, if the s1 and s2 are equal;
A negative value if s1 is less than s2;
A positive value if s1 is greater than s2;