Hi there,

I'm trying to write a program that calculates the probability distribution for different initial conditions of a population model. The probability is calculated over a for loop over the parameter 'q' (which can be considered as a scaled version of the correcting "struggle for life" term in the Malthus model).

The program includes methods for normalising the resulting probability distributions, and to test if they are working the program (in a seperate source file) performs a numerical integration (according to a Gauss-Laguerre method which basically picks out a number of, say 8, particular values of q and assigns them weights).

This function is:

```
double norm(double pst, double y)
{
double ab [] = {0.170, 0.904, 2.251, 4.267, 7.046, 10.759, 15.741, 22.863};
double w [] = {3.69E-01, 4.19E-01, 1.76E-01, 3.33E-02, 2.79E-03, 9.08E-05, 8.49E-07, 1.05E-09};
double v [8];
for (int i=0; i<8; i++)
{
if (abs(ab[i]-y)<0.0001)
{
v[i] = w[i]*pst;
return v[i];
}
else
{
return 0;
}
}
```

where pst is the probability for a particular value of q.

In the main source file, I put the function header as:

`double norm(double, double);`

Is that correct?

Also I call the function within the for loop:

```
for (double y =0.001; y<30.00; y+=0.001)
{
double pst = n*pow(y,n1)*exp(-y);
double q[] = norm(pst, y);
}
```

The idea being that for the 8 values of 'q' corresponding to those needed by the Gauss-Laguerre method, the norm function will return a number which I want to store in an array of 8 in the program.

The main problem is the error:

`error C2064: term does not evaluate to a function taking 2 arguments`

The second problem is that I don't want the array to be overwritten each time the function finds a matching value of 'q'...any ideas on how to store matches within the for loop?

It doesn't matter whether I need to declare the array size or not as there are always 8 matches.

Right...think that's it. I know this is relatively simple from a programming point of view, so I am posting this in the beginners forum. Any help would be much appreciated!

Thanks.