#include
#include
#include
void vsmallest(char *message, ...);
int main()
{
vsmallest("Print %d integers, %d %d %d",10,4,1);
return(0);
}
void vsmallest(char *message, ...)
{
int inumber_of_percent_ds=0;
va_list type_for_ellipsis;
int ipercent_d_format = 'd';
char *pchar;
pchar=strchr(message,ipercent_d_format);
while(*++pchar != '\0') {
pchar++;
pchar=strchr(pchar,ipercent_d_format);
inumber_of_percent_ds++;
}
printf("print %d integers,",inumber_of_percent_ds);
va_start(type_for_ellipsis,message);
while(inumber_of_percent_ds--)
printf(" %d",va_arg(type_for_ellipsis,int));
va_end(type_for_ellipsis);
}