Why am I able to use a locally declared const int as the size of an array declaration but am not allowed to do the same with a const int passed as
const int
Since c++11 though you can use constexpr which would do what you expect. The constexpr says compiler that apart the variable is const its value can be evaluated at compile time. See: http://en.cppreference.com/w/cpp/language/constexpr
constexpr
const