题目链接 Acwing 765
我想把字符串复制然后在字符间加空格,为啥有些结果输出会多输出一些乱码字符呢
错误的代码:
#include <cstdio>
int main()
{
char c[101], s[301];
fgets(c, 101, stdin);
for(int i=0; c[i] ; i++){
s[2*i] = c[i];
s[2*i+1] = ' ';
}
for(int i=0; s[i]; i++)
printf("%c", s[i]);
return 0;
}
编译器报了什么错误?Compile Error? Runtime Error?
提问于18天前
4143