Possible Duplicates:
C variable declarations after function heading in definition
What is useful about this C syntax?
I trying to understand some C code and came across this where variables are declared between the head of the function and the first brace.
Any Idea what these variables are?
Are they local or global?
What does the author intend to do here?
void someFunction (m_ptr, n_ptr, params, err)
integer *m_ptr; /* pointer to number of points to fit */
integer *n_ptr; /* pointer to number of parameters */
doublereal *params; /* vector of parameters */
doublereal *err; /* vector of error from data */
{
//some variables declared here
int i;
...
...
//body of the function here
}
They are function arguments. This is an alternative way to declare them. They work the same way as normal arguments.
For a rather long but very informative explanation see Alternative (K&R) C syntax for function declaration versus prototypes
Those variables are a declaration of the arguments. Not sure why anyone use that style any more. Those types must be typedef's though.
If this is old legacy code, did void really exist as a keyword back then?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With