操作系统库-atoi()函数
来源:互联网 发布:python股票量化分析 编辑:程序博客网 时间:2024/06/07 19:04
函数实现源代码来源于操作系统内核:
atoi()函数的功能:将字符串转换成整型数;atoi()会扫描参数p字符串,跳过前面的空格字符,直到遇上数字或正负号才开始做转换,而再遇到非数字或字符串时('\0')才结束转化,并将结果返回(返回转换后的整型数)。
/* atoi.c - atoi *//*------------------------------------------------------------------------ * atoi - Converts an ascii value to an integer. *------------------------------------------------------------------------ */int atoi(char *p){ int n = 0, f = 0; for (;; p++) { switch (*p) { case ' ': case '\t': continue; case '-': f++; case '+': p++; } break; } while (*p >= '0' && *p <= '9') { n = n * 10 + *p++ - '0'; } return (f ? -n : n);}
0 0
- 操作系统库-atoi()函数
- atoi函数
- atoi函数
- atoi () 函数
- atoi函数
- atoi()函数
- atoi 函数
- atoi函数
- atoi函数
- atoi函数
- atoi函数
- atoi函数
- atoi函数
- atoi函数
- atoi()函数
- atoi函数
- atoi函数
- atoi()函数
- I2C总线协议和控制器解析
- 求二范数C++代码
- ccf2014031
- react学习笔记 item9 ---双向绑定(mixin)
- servlet
- 操作系统库-atoi()函数
- 工厂设计模式
- android-lite-http处理http异常返回时的content数据读取
- js学习笔记:Ajax
- 老毛桃U盘快速安装ghost win7系统图文教程
- React Native环境配置(android,windows)
- 11.23关于微信JSAPI缺少参数的问题解决
- Android之第三方框架使用汇总
- mysql中字段类型及字符集