#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
Why doesn't this work?
See Question&Answers more detail:os