imds中标准材料编号:if(strcmp(ch,"yingcang")==0)printf("隐藏要素\n")为什么要==0

来源:百度文库 编辑:神马品牌网 时间:2024/05/15 23:56:42
if(strcmp(ch,"yingcang")==0)printf("隐藏要素\n")为什么要==0
=0时候不是值为假么,这句话只有在=0时候才可以输出,解释下为什么,谢谢

就是如果在ch里面没有找到yingcang字符串,也就是找到字符串数目是0则打印输出/

Compare strings.

int strcmp( const char *string1, const char *string2 );

int wcscmp( const wchar_t *string1, const wchar_t *string2 );

int _mbscmp(const unsigned char *string1, const unsigned char *string2 );

Return Value

The return value for each of these functions indicates the lexicographic relation of string1 to string2.

Value Relationship of string1 to string2
< 0 string1 less than string2
0 string1 identical to string2
> 0 string1 greater than string2