Click here to Skip to main content
15,891,888 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I am wondering how to create a function with variable number of arguments !?
printf() do that!
Posted

1 solution

See this, for example: http://publications.gbdirect.co.uk/c_book/chapter9/stdarg.html[^].

This is related to the order of parameters on stack. To use variable number of arguments, you need to use C calling conventions. This is pretty good explanation and code sample (referring to your printf, by the way): http://www.go4expert.com/forums/showthread.php?t=17592[^].

—SA
 
Share this answer
 
v2
Comments
Yusuf 14-Mar-11 20:01pm    
Good pointers
Sergey Alexandrovich Kryukov 14-Mar-11 20:03pm    
Thank you, Yusuf.
--SA
Mr. Tomay 14-Mar-11 20:07pm    
It seems clear now. Thanks for the links
Sergey Alexandrovich Kryukov 14-Mar-11 20:22pm    
No problem, thank for accepting my answer.
Good luck, call again,
--SA
AspDotNetDev 14-Mar-11 21:16pm    
"call again" -- were you talking to him on the phone?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900