It looks at the format specifiers (e.g. %d, %f, %s...) in the format string to figure out how far it has to index through the stack to access each individual parameter. For instance printf("%d %f", myint, myfloat); knows that since the first specifier was %d that the first argument is 32-bits wide and is an integer, and it will increment ptr_arg (common name for the argument pointer) 4 bytes to access the float that comes after it in the stack. There is usually a required parameter like this in a function that has variable argument lists so it knows how to access parameters correctly and doesn't corrupt the stack. Although you could implement it in many different ways.
An available explanation that I know of on the web for this concept is at http://msdn.microso
ft.com/library, just search for va_arg and you will find a variable argument list overview document.
Jason F.
Applications Engineer
National Instruments
www.ni.com/ask