Only fixed-size arrays can be allocated that way. Either allocate memory dynamically (int* foo = new int[N];
) and delete it when you're done, or (preferably) use std::vector
instead.
(Edit: GCC accepts that as an extension, but it's not part of the C++ standard.)