【发布时间】:2013-01-18 21:27:54
【问题描述】:
c/c++ strncmp 签名如下:
int strncmp ( const char * str1, const char * str2, size_t num );
我的问题是如果 num 为 0,返回值是多少?标准怎么说?从一些在线文档中找不到答案。
谢谢。
【问题讨论】:
-
逻辑上它应该是 0,因为其中一个字符串不可能大于或小于另一个。
-
你总是可以try it and see。