| 发表于:2007-05-12 08:26:575楼 得分:10 |
这样就和环境有关了。 char s1[]={ 'h ', 'e ', 'l ', 'l ', 'o '}; char s2[]={ 'h ', 'e ', 'l ', 'l ', 'o ', '\0 '}; ... 如果s1和s2是连续的,那么puts(s1);也许会输出 hellohello...... 但是也有可能是 输出 hello接一堆乱码。 puts 的结果不应该和 clsclr 有任何关系, 楼主你可以测试下这段代码: char s1[]={ 'h ', 'e ', 'l ', 'l ', 'o '}; char s2[]={ 'h ', 'e ', 'l ', 'l ', 'o ', '\0 '}; char s3[]= "hello "; //system( "cls "); /* @1 删除这一行 */ puts(s1); puts(s2); puts(s3); 最好使用多个环境试试, 比如 dev c++ 中 | | |
|