字符串比较函数

来源:互联网 发布:php电影播放器源码 编辑:程序博客网 时间:2024/05/22 15:09
int my_strcmp(char *str_1, char *str_2){while (*str_1 == *str_2 && *str_1++ && *str_2++);return *str_1 - *str_2;}
int strcmp(char *str1, char *str2){for (;; str1++, str2++){if (*str1 == *str2)if (*str1 == '\0')break;elsecontinue;elsebreak;}return *str1 - *str2;}


4 0
原创粉丝点击