关于strtod
来源:互联网 发布:红雪越狱工具mac 编辑:程序博客网 时间:2024/06/01 21:20
先看个简单例子:
#include <iostream>
using namespace std;
void change(char *s)
{
s++;//错误 并没有办法改变它的地址!!
}
int main()
{
char d[] = "dsaggd";
char *s = d;
change(s);
cout<<*s<<endl;
}
所以正确的想要改变s的地址的做法是采用指针的指针
#include <iostream>
using namespace std;
void change(char **s)
{
(*s)++;//正确,正确的修改了地址值
}
int main()
{
char d[] = "dsaggd";
char *s = d;
change(&s);
cout<<*s<<endl;
}
在函数change()中*s实际上是指向实参s地址的内容,而s又是存放字符串的地址,所以能做出相应的改变。
字符串转double
double strtod(const char *nptr, char **endptr);char* p;
number_ = strtod(&buf_[curPos_], &p);
有个疑问,为什么用指针的指针?
因为指针传递本质上也是值传递,需要改变的是指针本身,而不是指针所指向的内容,所以用到指针的指针!
0 0
- 关于strtod
- strtod()
- strtod
- strtod() 函数
- strtod函数
- atof&strtod
- strtod函数
- strtod()函数
- strtod-strtod, 字符串 转 数字 函数
- atoi,atol,strtod,atof
- atoi,atol,strtod,atof
- strtol,strtoul,strtod
- atoi,atol,strtod,atof
- atoi,atol,strtod,atof
- strtol,strtoul,strtod .
- strtod、strtof、strtold笔记
- strtod函数的使用
- C语言strtod函数DEMO
- Qt Model/View( 一)
- 简单的自动更新程序实现
- c++中的继承与多态
- 代码中特殊的注释技术——TODO、FIXME和XXX的用处
- Qt的Model/View (二)
- 关于strtod
- Android fill_parent、wrap_content和match_parent的区别
- plsql developer如何查询SQL语句执行历史记录
- IBatis SqlParameter参数数量超过2100报错
- uva 10405 Longest Common Subsequence
- DirectX 9.0 (2) 矩阵
- win2003 IIS网站权限设置
- Shell脚本中的export
- asp.net 导出Table到Excel,数字前的加号无法显示的问题