小编Sha*_*ist的帖子

在C中创建我自己的strcmp()函数

我的老师指派我strcmp()在C中编写自己的函数.我确实创建了自己的函数版本,我希望得到一些反馈.

int CompareTwoStrings ( char *StringOne, char *StringTwo ) {
    // Evaluates if both strings have the same length.
    if  ( strlen ( StringOne ) != strlen ( StringTwo ) ) {
        // Given that the strings have an unequal length, it compares between both
        // lengths.
        if  ( strlen ( StringOne ) < strlen ( StringTwo ) ) {
            return ( StringOneIsLesser );
        }
        if  ( strlen ( StringOne ) > strlen ( StringTwo ) ) { …
Run Code Online (Sandbox Code Playgroud)

c strcmp

1
推荐指数
1
解决办法
2万
查看次数

标签 统计

c ×1

strcmp ×1