Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
c/c++ strncmp 签名如下:
int strncmp ( const char * str1, const char * str2, size_t num );
我的问题是如果 num 为 0,返回值是多少?标准怎么说?不要从一些在线文档中找到答案。
谢谢。
Well, strncmp compares at most num characters from the two strings, so with num == 0, it compares none, hence finds no difference, thus it returns 0.
strncmp
num
num == 0