atoi函数的实现
来源:互联网 发布:飞腾排版软件官方下载 编辑:程序博客网 时间:2024/04/29 05:27
转自http://blog.csdn.net/udknight/article/details/1836799
int isspace(int x){ if(x==' '||x=='\t'||x=='\n'||x=='\f'||x=='\b'||x=='\r') return 1; else return 0;}int isdigit(int x){ if(x<='9'&&x>='0') return 1; else return 0;}int atoi(const char *nptr){ int c; /* current char */ int total; /* current total */ int sign; /* if '-', then negative, otherwise positive */ /* skip whitespace */ while ( isspace((int)(unsigned char)*nptr) ) ++nptr; c = (int)(unsigned char)*nptr++; sign = c; /* save sign indication */ if (c == '-' || c == '+') c = (int)(unsigned char)*nptr++; /* skip sign */ total = 0; while (isdigit(c)) { total = 10 * total + (c - '0'); /* accumulate digit */ c = (int)(unsigned char)*nptr++; /* get next char */ } if (sign == '-') return -total; else return total; /* return result, negated if necessary */}
- atoi函数的实现
- atoi()函数的实现
- atoi()函数的实现
- atoi函数的实现
- atoi函数的实现
- atoi函数的实现
- atoi函数的实现
- atoi函数的实现
- atoi函数的实现
- atoi()函数的实现
- atoi()函数的实现
- atoi()函数的实现
- atoi函数的实现
- atoi()函数的实现
- atoi函数的实现
- atoi()函数的实现
- atoi()函数的实现
- atoi函数的实现
- 自己面试总结
- Listview列表之下拉刷新
- 不同Framework中DAO层的分析
- desktop文件中Exec的field codes
- java聊天室 提交预版 服务器
- atoi函数的实现
- Android 横竖屏切换生命周期
- java中的io系统详解
- oracle集合运算详解
- java聊天室 提交预版 对话框
- HTML代码格式化 HTML Tidy Notepad++
- Objective-C 宏
- Oracle 11g R2安装手册 For Win7 (图文教程)
- 黑马程序员------html一些简单的用法之二