A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© pojian 中级黑马   /  2016-3-10 14:16  /  1000 人查看  /  0 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

以下与库函数strcmp(char *s, chat *t)的功能相等的程序段是()。
A. strcmp1( char *s, chat *t)
{
    for ( ;*s++==*t++ ;)
    {
        if (*s=='\0')
        {
            return 0;
        }
    }
    return (*s-*t);
}
B. strcmp2( char *s, char *t)
{
    for ( ;*s++==*t++ ;)
    {
        if (!*s)
        {
            return 0;
        }
    }
    return  (*s-*t);
}
    C. strcmp3( char *s, char *t)
    {
        for ( ;*t==*s ;)
        {
            if (!*t)
            {
                return 0;
            }
            t++;
            s++;
        }
        return (*s-*t);
    }
    D. strcmp4( char *s, char *t)
    {
        for( ;*s==*t;s++,t++)
        {
            if (!*s)
            {
                return 0;
            }
        }
        return (*t-*s);
    }
   



0 个回复

您需要登录后才可以回帖 登录 | 加入黑马