Reputation: 53
I simply try to define a vector named numlist
in the function createlist
but the errors I get are:
expected constant expression
cannot allocate an array of constant size 0
'numlist' : unknown size
'numlist' undeclared identifier
its just this line in the function
int langd=3;
int numlist[langd];
Upvotes: 1
Views: 59
Reputation: 145899
You are using a c89 compiler, variable length array is a c99 feature.
To fix your program, use a constant:
#define LANGD 3
int langd = LANGD;
int numlist[LANGD];
Upvotes: 5