atoi函数实现
来源:互联网 发布:ag游戏平台源码 编辑:程序博客网 时间:2024/05/22 11:51
公司笔试喜欢让写这个函数,这里实现一下,欢迎指正:
int my_atoi(const char *str){assert(str != NULL);int flag = 1;int result = 0;while(*str == ' ' || *str == '\n' || *str == '\t'){++str;}if(*str == '-'){flag = -1;++str;}else if(*str == '+'){++str;}while(*str != '\0'){if(*str >= '0' && *str <= '9'){result = result*10 + *str - '0';}else{return flag * result;} ++str;}return flag * result;}
- atoi函数实现
- atoi,itoa函数实现
- atoi函数的实现
- atoi()函数的实现
- atoi函数实现
- atoi函数实现
- atoi函数实现
- atoi函数实现_buwanmei
- 实现atoi函数
- atoi函数实现
- atoi()函数的实现
- atoi函数的实现
- atoi函数的实现
- atoi函数实现
- atoi函数实现
- atoi函数实现
- atoi函数的实现
- atoi函数实现
- glib源码学习
- for循环的基础面试,确定能答对??
- 水利行业相关资料
- Securing Your Connection String in Windows Azure: Part 1
- cursor
- atoi函数实现
- 2012C++程序设计实验报告【9.2】
- 在Qt Creator中使用Opencv 2.3
- 李践版 绩效能力日志
- Oracle ROWID 方式访问数据库
- Spring 3.0 AOP学习
- IOS App资源路径
- 【转】Perl的die、warn、eval函数
- Android 菜单(OptionMenu)大全 建立你自己的菜单