雕刻时光

just do it……nothing impossible
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2013年11月20日

摘要: 主要考虑,字符串中是否有非法字符,字符串是否有溢出控制#includeint myatoi(const char *str){ int sight=1,ret=0,i=0; if(str[i]==' ')i++; int max=(1='0'&&str[i]max){//溢出控制 ret=max;break; } } return ret*sight;}int main(){ printf("%d\n",myatoi("214748.3649"));}View Code 后来仔细想想发现自己的代码弱爆了!改 阅读全文

posted @ 2013-11-20 18:03 huhuuu 阅读(516) 评论(0) 推荐(0) 编辑