int mystery( const char *s1, const char *s2 ) {
for( ; *s1 != '\0' && *s2 != '\0'; s1++, s2++ ) {
if( *s1 != *s2 ) {
return 0;
} //end if
} //end for
return 1;
}
Run Code Online (Sandbox Code Playgroud)
我知道它有输入错误,但这正是它的原因.谢谢你们,我需要它也运行,我已经添加了变量声明,但我得到编译器错误说
在功能上,'或';' 在'{'之前`int main()':
error: a function-definition is not allowed here before '{' token
error: expected
Kla*_*sen 11
它比较两个字符串,1
如果字符串1以字符串2开头则返回,反之亦然0
.
归档时间: |
|
查看次数: |
674 次 |
最近记录: |