プログラムが最初に実行されるたびにランダムなサイズの配列を作成したいのですが、コンパイラーが私を怒鳴りつけます
"Error 2 error C2466: cannot allocate an array of constant size 0"
SIZE
最初にbyをランダムに選択しSIZE = rand() % 100
、配列をint myarray[SIZE]={0}
???で初期化する方法はありますか? または、最初に正確な番号で毎回初期化する必要がありますか?
int main(void) {
int i;
int SIZE=rand()%100;
int array2[SIZE]={0};
for(i=0;i<SIZE;i++) //fill the array with random numbers
array2[i]=rand()%100;
...
}