[英]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];
一個錯誤
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);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.