gpt4 book ai didi

c - 这个函数有什么作用?

转载 作者:太空狗 更新时间:2023-10-29 15:11:07 25 4
gpt4 key购买 nike

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;
}

我知道它有打字错误,但事实确实如此。谢谢大家,我也需要它来运行,我已经添加了变量声明,但是我收到了编译器错误,上面写着

函数中`int main()':<br/>
error: a function-definition is not allowed here before '{' token<br/>
error: expected
,' 或 `;'在“{”标记之前

最佳答案

它比较两个字符串,如果字符串 1 以字符串 2 开头则返回 1,否则返回 0

关于c - 这个函数有什么作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4054496/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com