On Feb 18, 2008 9:09 AM, Kiran Divakaran <[EMAIL PROTECTED]> wrote:
>
> Hi All,
>
> Please let me know how variable argument functions can be dynamically churned
> and the va_start , va_arg , va_end functions be used for the same.
>
> Generally the va_ functions are used when the variable list of arguments are
> expected to a function like say
>
> int test_routine(char *s, const char *format, ...)
One of the defined arguments ('s' and 'format' in your example) should
indicate the number of, and type, of the variable arguments supplied.
printf(), for example has the % placeholders in the 'format' string to
perform this function.
> now I could have calls like the below and all of them would be handled by the
> above definition .
>
> All the below calls are hard coded and calls are made .
>
>
> test_routine("Hello" , "Test", 1 , 100 , "Mark");
> test_routine("Hello" , "Test", 1 "Twain");
> test_routine("Hello" , "Test", 1 , 100 );
Here you don't appear to give any indication of what the variable
arguments are - and it's impossible to (generically) query the va_
system to find them out.
--
PJH
http://shabbleland.myminicity.com