How do I call this function?

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2007
Posts: 28
Reputation: driplet is an unknown quantity at this point 
Solved Threads: 0
driplet driplet is offline Offline
Light Poster

How do I call this function?

 
0
  #1
Feb 1st, 2008
The function is as follows:

void Runthrough(double * from, double * to, double * when, double * howmuch)
{
nflows += 1;

if (nflows > LENFST)
{ /* Stack Overflow */
Application->MessageBox("Error occurred.", MB_OK);
return;
}
else
{ /* Store the arguments in the stack */
flowstack[nflows].from = from;
flowstack[nflows].to = to;
flowstack[nflows].when = *when;
flowstack[nflows].amt = *howmuch;
}

return;
}

--------------
when I call in the main program: Runthrough(a1,b1,time,amount), a1,b1,time,amount all defined as double, I got error message: incompatible conversion, type mismatch, and cannot convert "long[*][long]" to "double". I don't use array here.

Can any one help to find the problem?

Thx,
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 97
Reputation: plgriffith is an unknown quantity at this point 
Solved Threads: 6
plgriffith plgriffith is offline Offline
Junior Poster in Training

Re: How do I call this function?

 
0
  #2
Feb 1st, 2008
Could you include your whole code? It could be something in main.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1,951
Reputation: Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of 
Solved Threads: 214
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: How do I call this function?

 
0
  #3
Feb 1st, 2008
The problem is that a1, b1, time, and amount are all defined as double, and your routine wants a pointer to double.

Call as:
Runthrough(&a1,&b1,&time,&amount);

Since this is C++, you could prototype your function as
  1. void Runthrough(double &from, double &to, double &when, double &howmuch)
  2. {
  3. ...
  4. }
then you could call the function the way you were.

In either case, one line or the other must have &'s.

Please use [code] tags.

Hope this helps.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC