Error

On line four I am getting the error 'expected primary expression before int'. I've fiddled around with it and I just can't figure out what I'm doing wrong.

1
2
3
4
5
6
7
8
9
10
11
12
void computeMaximum(const int data[], int& i)
{
    int comp = data[i];
    for(int j = 0; j < YEARS; j++)
    {
        if(comp < data[j])
        {
            comp = data[j];
            i = j;
        }
    }
}
There is nothing wrong with computeMaximum() normally.
Can you show us the declaration of YEARS?
1
2
3
4
5
6
7
8
9
10
11
12
13
extern const double DEATH_RATE = 0.1;

extern const double CONVERSION_RATE = 0.00001;

extern const double GROWTH_RATE = 0.4;

extern const double WOLF_ABILITY = 0.0005;

extern const int CAPACITY = 30000;

extern const int YEARS= 100;

extern const int TABLE_INCREMENT = 10;
Topic archived. No new replies allowed.