Author |
Topic: Function with variable no of arguments! (Read 626 times) |
|
tuxilogy
Newbie
Posts: 45
|
|
Function with variable no of arguments!
« on: Jun 5th, 2006, 9:44am » |
Quote Modify
|
Hi * The syntax to define a function that can take vairable no of arguments is int try_try(int *, ...); // With three dots esp, because the compiler treats this function can take variable no of arguments. but during the defination of the this function how we can figure out ; what arguments the user has typed during calling of (try_try() function) in the main() function... Kindly help me in this issue... TUX
|
|
IP Logged |
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: Function with variable no of arguments!
« Reply #1 on: Jun 5th, 2006, 2:06pm » |
Quote Modify
|
You need to use "va_start" and "va_list"s (you should be able to find something googling with that, I'm short on time atm) [edit] http://www-ccs.ucsd.edu/c/stdarg.html [/edit]
|
« Last Edit: Jun 5th, 2006, 2:41pm by towr » |
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
|