Variable Number Of Arguments
How does printf work ?printf(const char * format, …);you can use 0 or more different variables instead of the ellipses(…)
The first parameter must be explicit, so … can appear only at the end of the argument list.
When this function is being called at run time,the number and type of arguments being passed must somehow be made known to the called function. In printf , the format string holds this information.
How to refernce the unnamed arguments ?Functions in stdarg.h : - va_start: function to init access to args.- va_arg: function to access individual args.- va_end: function for clean up