2013/10/18

"va_*()" in c programming

Quick and dirty summery
va_*() are macros helping you to implement functions with dynamic arguments numbers.

Dig deeper
what is va_*()  ?
They are va_start(), va_arg(), va_end() respectively. Those macros will be used if you want to implement a function with vary arguments. For example, printf().

va_start(); /* call before va_arg(), otherwise va_arg() cannot function properly*/
va_arg(); /* return 1st, 2nd, 3rd.... arguments for 1st, 2nd, 3rd ...calls */
va_end(); /* call before returning value */

There are some examples codes on the reference link.

Reference
http://tw.myblog.yahoo.com/jw!kg_rIFWTHgO4kRtDoy15QxVeWQ--/article?mid=21&prev=22&l=f&fid=5

沒有留言:

張貼留言