本文介绍了引起一些问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
由于某种原因,当我尝试编译该程序时,发生了奇怪的事情,例如文件名更改为"string.h".有任何想法吗?
For some reason when I try to compile this program strange things are happening like the file name is changed to "string.h". Any ideas?
#include <stdio.h>
#include <string.h>
int main()
{
char str1[20] = "Hello\0" ;
char str2[20] = "everyone\0" ;
printf("%i\n",strlen(str1)) ;
printf("%i\n",strcmp(str2)) ;
return 0;
}
推荐答案
顺便说一句,您不必在定义的字符串的末尾添加"\ 0".
By the way, you don''t have to add "\0" to the ends of the strings you define. The compiler will do that for you.
哪个文件正在更改为string.h?上面的代码所在的文件?
And which file is changing to string.h? The file that the above code is in?
这篇关于引起一些问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!