strcmp 与strncmp

在比较字符串的时候最好使用 strncmp.

今天写代码时,使用strcmp 比较2个字符串,第一次比较没有问题,第二次比较老是失败。后来换成strncmp就没有问题了

你可能感兴趣的:(strcmp 与strncmp)