C++ - 数组类型"无符号__int64 [金额*]"不可分配
C++ - array type 'unsigned __int64 [amount*]' is not assignable
我正在Visual 2015和代码的这一部分中编写算法的实现
int amount;
//some code that change value of variable amount
uint64_t table[amount*9];
a收到错误
array type 'unsigned __int64 [amount*]' is not assignable
我读到我应该初始化一个数组,所以我做了
uint64_t table[amount*9] = {0};
但这无济于事。有什么建议吗??
C++不支持可变大小的数组。改为使用std::vector
:
int amount;
//some code that change value of variable amount
std::vector<uint64_t> table(amount*9);
相关文章:
- 是否可以初始化不可复制类型的成员变量(或基类)
- 不同翻译单元中不可重载的非内联函数定义
- 是默认情况下分配给char数组常量的值
- 当我尝试使用 sstream 和分面将 Boost Time_duration转换为字符串时,我没有得到所需的格式
- 使lambda不可复制/不可移动
- C++typeid模板值转换为联合不可接受的转换
- 班级的朋友是不可接近的
- 在C++中将变量 wstring 分配给 Char 数组
- opengl glBegin(GL_LINES) 和 glBegin(GL_POINT) 在 2D 中不可视化点矢量
- 内存错误低于在C++年实现埃拉托色尼筛分时的预期
- 如何从QFile阅读?它显示该文件不可访问
- 在std::launder之前,std::vector的所有实现都是不可移植的吗?
- 为什么我能够为阵列分配比计算机实际拥有的内存更多的内存
- 如何将内联匿名函数分配给C++函数指针
- 指针问题:从不兼容的类型"int"分配给"int *"
- 为什么使用析构函数会使类不可复制?
- 数组类型 int[n][n] 不可赋值,因为表达式必须具有常量值
- 组合框第一行不可选择
- 将货币金额四舍五入到最接近的镍、四分之一、1 美元、5 美元等面额的最佳方法是什么?
- C++ - 数组类型"无符号__int64 [金额*]"不可分配