MS Research PhD Research Curriculum Vitae
On-line Stores Cycling Medicine & Health LaTeX OOP & C++ Sony PCM-R500 DAT |
![]() |
Next: Calculating the point of Up: Implementing function-functions Previous: Implementing function-functions   Contents   Index The remedy--variable number of argumentsIn C it is allowed for a function to have a variable number of arguments--in analogy with the printf standard function. The new strategy is illustrated by the following prototype for the non-linear solver.
double solve2(double guess, double (*FCN) (double, va_list), ...);
In regard to this prototype we have the comments
double f_alpha(double x, va_list vlist);
The drawbacks are seen clearly
If one wishes to have some check of the number of parameters at run-time one could pass the number of parameters to FCN (eg f_alpha) as the first parameter. This strategy is used in the source code written by the author. In conclusion we may state that this last method seems preferable when compared to the former which uses global variables.
Next: Calculating the point of Up: Implementing function-functions Previous: Implementing function-functions   Contents   Index Revision 2.0, Copyright © 1999-2004 Jakob Christensen http://www.JakobCHR.com E-Mail: webmaster@JakobCHR.com
|