gpt4 book ai didi

c++ - 为什么以下 C++ 代码无法编译?

转载 作者:太空宇宙 更新时间:2023-11-04 16:31:23 25 4
gpt4 key购买 nike

#include <iostream>
int test( const double *t1,const double **t2 )
{
return 0;
}
int main(int argc, char*argv[])
{
double *t1 = new double;
const double ** t2 = new double *;
test(t1, t2);
}

错误是:

cannot convert double ** to const double **

如果我删除 const 的第 2 次出现,它会编译..

最佳答案

成功了

const double ** t2 = new const double *;

关于c++ - 为什么以下 C++ 代码无法编译?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6518319/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com