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 -

What is the difference between data design and data model(ERD) -

ios - Can NSManagedObject conform to NSCoding -