wu :: forums (http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi)
riddles >> cs >> Function with variable no of arguments!
(Message started by: tuxilogy on Jun 5th, 2006, 9:44am)

Title: Function with variable no of arguments!
Post by tuxilogy on Jun 5th, 2006, 9:44am
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

Title: Re: Function with variable no of arguments!
Post by towr on Jun 5th, 2006, 2:06pm
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]



Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board