July 2015
Intermediate to advanced
380 pages
10h 15m
English
In C, you can create your own versions of functions like printf and scanf by creating a variable argument function, or vararg function. These functions use the header stdarg.h, and with them, you can create nicer interfaces to your library. They are handy for certain types of builder functions, formatting functions, and anything that takes variable arguments.
Understanding vararg functions is not essential to creating C programs. I think I’ve used it maybe 20 times in my code in all of the years I’ve been programming. However, knowing how a vararg function works will help you debug the programs you use and gives you a better understanding of the computer.
ex25.c
1 2