#include<iostream>
using namespace std;
const int vals[] = {0, 1, 2, 3, 4};
int newArray[ vals[2] ]; //"error: array bound is not an integer constant"
int main(){
return vals[2];
}
//returns 2 if erroneous line is removed
Warum funktioniert das nicht?Array-Größe von einem anderen Array-Wert initialisieren
oder sogar noch besser, 'std :: VECTOR'. –
Sieht aus wie eine Antwort auf eine andere Frage an mich –