C++ 2d array initialization -


the following line doesn't work:

int n1=10,v1=10;   int f[n1][v1]={}; error: variable-sized object ‘f’ may not initialized 

but line below works, why?

const int n1=10,v1=10;   int f[n1][v1]={}; 

array initializers need const.

an int value can change const int value remain constant throughout entire program.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -