"ian" <ip*****@yahoo.comwrote:
What is
void daily_log(char *, ...);
saying, the 3 periods?
This really should be in your textbook. It's a prototype for a function
with a variable number of arguments (also known as a variadic function).
When it's called, it must have at least one argument that is a char *,
and any number of extra arguments. If you call it, that's all you need
to know, really; it functions just like, e.g., printf(). One other
thing: you must have a prototype in scope when you call a variadic
function, and you can't rely on automatic type conversion in the
variable arguments.
If you want to write a function like this yourself, you use the
functionality provided by <stdarg.hto do so. Note that there's no way
to find out how many arguments were passed in any call; you must find
that out from the arguments themselves, e.g. from information present in
the non-variable arguments (as in printf()), or from a special marker
argument (e.g., the last argument could always be a null pointer).
Richard