简体   繁体   English

C ++-数组类型'unsigned __int64 [amount *]'是不可分配的

[英]C++ - array type 'unsigned __int64 [amount*]' is not assignable

I'm writing implementation of algorithm in Visual 2015 and in this part of code 我正在Visual 2015和这部分代码中编写算法的实现

int amount;
//some code that change value of variable amount
uint64_t table[amount*9];

a got an error 一个错误

array type 'unsigned __int64 [amount*]' is not assignable

I read that i should initialize an array so i did 我读到我应该初始化一个数组,所以我做了

uint64_t table[amount*9] = {0};

But it didn't help. 但这没有帮助。 Any suggestions ?? 有什么建议么 ??

C++ doesn't support variable sized arrays. C ++不支持可变大小的数组。 Use std::vector instead: 使用std::vector代替:

    int amount;
    //some code that change value of variable amount
    std::vector<uint64_t> table(amount*9);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM