# problem with a function

Printable View

• 12-12-2006
Logan1033
problem with a function
i wrote this function to find and return the determinant of a 3x3 matrix...

Code:

```double getDeterminant(double (*matrix)[3]) {         double a = matrix[0][0];         double b = matrix[0][1];         double c = matrix[0][2];         double d = matrix[1][0];         double e = matrix[1][1];         double f = matrix[1][2];         double g = matrix[2][0];         double h = matrix[2][1];         double i = matrix[2][2];         double det = a(e*i) - (f*h) - b(d*i) - (g*f) + c(d*h) - (e*g);         return det; }```
the error i get is the line with the equation and it says

"error C2064: term does not evaluate to a function taking 1 arguments"

thanks for any help you can give me.
• 12-12-2006
Desolation
'a', 'b' and 'c' are not functions. They are variables. If you meant it to be a multiplication (like you would do in maths), you need to add a multiplication operator before the parenthesis. You can omit multiplication operators in maths, but not in C++.
• 12-12-2006
Logan1033
ahh ty i feel stupid.
• 12-13-2006
h_howee
suggestion:
itd be easier to change double a to i into an array and loop thru it