字符串
程序代码:
# include <stdio.h> # include <string.h> int main() { char ch[20], ch2[20]; int i; int len; gets(ch); len = strlen(ch); for(i=0; i<5; i++) ch2[i] = ch[i]; for (i=6; i<len; i++) ch2[i-1] = ch[i]; for (i=0; i<len-1; i++) printf("%c\n", ch2[i]); //1行 printf("%s\n", ch2); //2行 return 0; }
在VC++6.0的结果:
goodMoring
g
o
o
d
M
r
i
n
g
goodMring烫烫烫烫烫蘥oodMoring
---------------------------------------
为啥2行输出是会出现 烫烫烫烫烫蘥
[此贴子已经被作者于2016-2-2 16:49编辑过]