hw does printf(),scanf() nd all work??

J

jt

everytime we pass different number of variables.
even though there is no polymorphism concept in C.
hw do they accomplish.
 
S

santosh

jt said:
everytime we pass different number of variables.
even though there is no polymorphism concept in C.
hw do they accomplish.

The format string specifies everything that they need to know (and
expect) of the following arguments. In C, functions with variadic
arguments can accept differing number and type of arguments though they
must accept at least one fixed parameter. This is a somewhat advanced
topic in C. You don't need to worry about their actual mechanics until
much later.
 
K

Kenneth Brody

jt said:
everytime we pass different number of variables.
even though there is no polymorphism concept in C.
hw do they accomplish.

"Variadic functions", aka "varargs". The functions are defined as
taking an unspecified list of parameters of unspecified types.

For example:

int printf(const char * restrict format, ...);

--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:[email protected]>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top