# error messages

• 03-26-2007
lyojarhhs
error messages
If my function prototype is:
Code:

`void ltb_calculation(double deduction, double *ltb, double *gross_pay);`
and my main function has the function(with the variables declared as doubles):
Code:

`ltb_calculation(deduction, *ltb, *gross_pay);`
and my function is:
Code:

```void ltb_calculation(double deduction, double *ltb, double *gross_pay)  {   if (( *gross_pay / 100)  > 0) { *ltb= *gross_pay / 100;  if (*ltb > 50)  {   *ltb == 50;  } deduction= *ltb * 2; *gross_pay= *gross_pay - deduction; } }```
WHY do i get these error messages saying: "Function argument assignment between types "double*" and "double" is not allowed." ???
I have a LOT of these messages as i did the same thing for each function. Some one help?
• 03-26-2007
quzah
To pass the a non-pointer variable to a function, you use the address-of operator, not the happy little star.
Code:

```void foo( int *ptr ) { } ... int x; foo( &x );```

Quzah.
• 03-26-2007
lyojarhhs
Do you mean to change the main to:
Code:

`ltb_calculation(deduction, &ltb, &gross_pay);`
Because i'm trying that, and still getting the same error message. I think i misunderstood you?
• 03-26-2007
quzah
That depends on what you have lbt and gross_pay declared as. See how simple it is to make a test case?
Code:

```void ltb_calculation(double deduction, double *ltb, double *gross_pay) {     /* do nothing of importance */     if( ltb ) *ltb = 0.0;     if( gross_pay ) *gross_pay = 0.0;     deduction = 0.0; } int main( void ) {     double a, b, c;     ltb_calculation( a, &b, &c );     return 0; }```
Compile, run, be amazed!

Quzah.
• 03-26-2007
lyojarhhs
Thanks. Maybe next time you should try it without as much sarcasm.
• 03-27-2007
quzah
If I wanted your advice, I would have asked. Notice I didn't. Maybe by the nex time you ask, you'll have actually learned how to ask questions the smart way. Oh, since I'm here, you'll also notice that I answered your question correctly in the first post. If you hadn't have been so stupid, I wouldn't have had to answer the same question twice.

Quzah.