# Finding the maximum area of three XY points in an array of XY points

I'm trying to find the maximum area using three XY points in an array of XY points in the form of (X,Y).

I'm currently getting the error called object type 'double' is not a function or function pointer where the area function is called and I'm not sure why. Also, I have no idea if this function is even close to being right, I'm just messing around at this point. Thanks for the help!

```double area( const Point & a, const Point & b, const Point & c){

double side1 = a.distance(b);
double side2 = b.distance(c);
double side3 = c.distance(a);
double s = (side1 + side2 + side3 / 2.0);

return sqrt(s * (s - side1) * (s - side2) * (s - side3));
}

double maxArea( const Point a[], unsigned elements ){

double area = 0;
double tempArea = 0;

for (unsigned i = 0 ; i < elements; i++)
for (unsigned n = 0; n < elements; n++)
for (unsigned p = 0; p < elements; p++) {
tempArea = area(a[i],a[n],a[p]); //error here
if(tempArea > area){
area = tempArea;
}
}
return area;
}
```

```double area = 0;

tempArea = area(a[i],a[n],a[p]);
///^^^
```

has the same name as your function area. try to use a different variable name, for example: maxArea. Meanwhile, better to change your function name to start with verb, for example: getArea or computeArea.

One more point:

``` double s = (side1 + side2 + side3 / 2.0);
```

should be

``` double s = (side1 + side2 + side3) / 2.0;
```