atol
来源:互联网 发布:nat模式网络配置 编辑:程序博客网 时间:2024/05/22 10:48
头文件:#include <stdlib.h>
定义函数:long atol(const char *nptr);
函数说明:atol()会扫描参数nptr 字符串,跳过前面的空格字符,直到遇上数字或正负符号才开始做转换,而再遇到非数字或字符串结束时('\0')才结束转换,并将结果返回。
返回值:返回转换后的长整型数。
附加说明:atol()与使用strtol(nptr, (char**)NULL, 10); 结果相同。
范例:将字符串a 与字符串b 转换成数字后相加。
执行结果:
c=1234567890
定义函数:long atol(const char *nptr);
函数说明:atol()会扫描参数nptr 字符串,跳过前面的空格字符,直到遇上数字或正负符号才开始做转换,而再遇到非数字或字符串结束时('\0')才结束转换,并将结果返回。
返回值:返回转换后的长整型数。
附加说明:atol()与使用strtol(nptr, (char**)NULL, 10); 结果相同。
范例:将字符串a 与字符串b 转换成数字后相加。
- #include <stdlib.h>
- main(){
- char a[] = "1000000000";
- char b[] = " 234567890";
- long c;
- c = atol(a) + atol(b);
- printf("c=%d\n", c);
- }
#include <stdlib.h>main(){ char a[] = "1000000000"; char b[] = " 234567890"; long c; c = atol(a) + atol(b); printf("c=%d\n", c);}
执行结果:
c=1234567890
0 0
- atol
- atol
- atol ()函数
- atol 函数
- atol实现
- atol 函数
- atoi,atol,strtod,atof
- atol的写法
- atol的实现代码
- atoi,atol,strtod,atof
- strtoul-atoi-atol-itoa
- atoi atol实现
- atoi,atol,strtod,atof
- atol函数简单实现
- C语言atol用法
- atoi,atol,strtod,atof
- atol和stoi的用途
- long atol(const char *nptr);
- redis基本操作
- strtod
- gcvt
- ubuntu SSH 远程登录和上传下载文件
- C++获得系统时间,以及1970年1月1日到现在的毫秒数
- atol
- 【小松教你手游开发】【unity实用技能】unity所有特殊文件夹的用途
- android 卸载程序、清除数据、停止服务使用方法
- atoi
- 移动前端调试方案(Android + Chrome 实现远程调试)
- 打印页面样式设计 控制一个table显示在一页上
- Cocos2dx 3.0游戏开发找小三之Cocos2d-x的动作机制:嘻,善哉!技盖至此乎?
- atof
- JAVA请求HTTPS协议