By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,413 Members | 1,017 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,413 IT Pros & Developers. It's quick & easy.

Proto Question

P: n/a

What is

void daily_log(char *, ...);

saying, the 3 periods?


Nov 6 '06 #1
Share this Question
Share on Google+
2 Replies

P: n/a
2006-11-06 <11**********************@f16g2000cwb.googlegroups .com>,
ian wrote:

What is

void daily_log(char *, ...);

saying, the 3 periods?
It means it can take different amounts of arguments. Like printf.

Read the documentation of your daily_log function for details.
Nov 6 '06 #2

P: n/a
"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).

Nov 6 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.