Here is the example of varargs
.
I'm a little puzzled.
[x]Question 1: How to get the nth argument?
va_list ap;
va_arg (ap + (n-1), int); // **INCORRECT USAGE**
Is it correct? If not, how to get the nth argument?
[x]Question 2: When will ap
increase?
It says ap
will increase to the next argument, but if I use va_arg(ap + (n-1), int), n>=2
, will ap
increase?
Question 3: (BTW/maybe off-topic) What's ap abbreviated from?
Sometimes, we declared Cnt
abbreviated from Count
or Counter
.
What's ap
abbreviated from?
Question 4: Which type is ap
?
I know it's va_list
type, but what is va_list
? struct? int? or something else?
Thanks.