Possible Duplicate:
What does … mean in an argument list in C ?
I was reading a book about win32 programming and i saw a function like this:
int CDECL MessageBoxprintf(TCHAR *szCaption,TCHAR *szFrmat,...)
{
TCHAR szBuffer[1024];
va_list pArgList;
va_start (pArgList,szFrmat);
_vsnprintf(szBuffer,sizeof(szBuffer)/sizeof(TCHAR),szFrmat,pArgList);
va_end (pArgList);
return MessageBox(NULL,szBuffer,szCaption,0);
}
what does ,... means in the parameters of a function?
I tried to find answers with searching but i got nothing useful.
It means you can have varible numbers of arguments to that function instead of a fixed number of arguments.
A perfect usecase would be
For example Lets say we have a function called average
you can call this function like this with any number of arguments
Also the arguments passed don’t have to be of the same type.
For more information look at this link