没有问题的。 在 2012-6-23 上午9:13,"唐亚伟" <[email protected]>写道:
> 0 == ‘\0’ 不对吧 > 在 2012-06-23 08:07:37,"Xunzhen Quan" <[email protected]> 写道: > >完全没有理解你想表达什么 > >在 2012-6-23 上午5:55,"[email protected]" <[email protected]>写道: > > > >> char buf[10]; > >> short i; > >> > >> for(i=0;i<5;++i) > >> buf[8-i]=buf[i]; > >> for(i=9;buf[i-1]=='0' && i>4;--i); > >> buf[i]=0; > >> puts(buf); > >> > >> 这样的话会输出一些乱七八糟的东西…… > >> 0是结尾,对伐 > >> 0=='\0',对伐 > >> > >> buf[i+1]=0; 这样就完全没有问题…… > >> 但是需要在前面那个地方结束字符串啊啊啊啊阿…… > >> > >> 最后折腾了一晚上,用别的方法拐着弯解决了,但是这个地方完全不能理解为什么…… > >> > >> ubuntu 12.04 > >> g++ 4.6.3 > >> > >> -- > >> http://about.me/hime/bio > >> -- > >> ubuntu-zh mailing list > >> [email protected] > >> https://lists.ubuntu.com/mailman/listinfo/ubuntu-zh > >> > >-------------- 下一部分 -------------- > >一个HTML附件被移除... > >URL: < > https://lists.ubuntu.com/archives/ubuntu-zh/attachments/20120623/c34bda13/attachment.html > > > >-- > >ubuntu-zh mailing list > >[email protected] > >https://lists.ubuntu.com/mailman/listinfo/ubuntu-zh > > > -- > ubuntu-zh mailing list > [email protected] > https://lists.ubuntu.com/mailman/listinfo/ubuntu-zh > -------------- 下一部分 -------------- 一个HTML附件被移除... URL: <https://lists.ubuntu.com/archives/ubuntu-zh/attachments/20120623/43edcfa4/attachment.html> -- ubuntu-zh mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-zh
