Errors about array
May 14, 2009 at 4:58pm UTC
I am trying to run a C source code about Evolutionary Programming.
I get these errors after the compilation.
Anyone can help me to fix it? I am using VC 2005
I need help urgently.
Here is the error part:--
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
double function14(int n)
{
double value;
int i,j;
double sum1,sum2,prod;
double a[n][25];
for (j=0;j<25;j=j+5)
{
a[0][j]=-32.0;
a[0][j+1]=-16.0;
a[0][j+2]=0.0;
a[0][j+3]=16.0;
a[0][j+4]=32.0;
}
error C2057: expected constant expression
error C2466: cannot allocate an array of constant size 0
error C2133: 'a' : unknown size
Thanks everyone
Last edited on May 14, 2009 at 5:13pm UTC
May 14, 2009 at 5:48pm UTC
Line 8: You cannot use a variable to declare an array.
Topic archived. No new replies allowed.