i have problem with array.

hi. im new to programming world.
im trying to practice and decided to make a little program to find out the "balance" between x amount of numbers.(the user will decide how many numbers will be involved)

now i tried to do this:
int i;
cout<< "How many items please?";
cin>> i;
float items[i];

but gets an error:
"error C2466: cannot allocate an array of constant size 0"

what am i doing wrong?
is it not possible to declare an array according to a veraible?
thanks in advance for all helpers.
Not like that.
float *items=new float[i];
Don't forget to free it after you're done.

http://www.cplusplus.com/doc/tutorial/dynamic.html
Topic archived. No new replies allowed.