C ++ supports parameters have default parameters, parameter placeholders, variable parameters:
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h> // must be the header file function to get the parameters of this header file in
// C ++ function in the variable parameter
// will prompt the user to pass the API parameter types
void func_param (int A, ...) {
// Get variable parameters
// pointer variable parameter defines
the va_list args_p;
// first specified variable parameters start position, the start position, using the pointer, refers to all the way down, taken out one by one
the va_start (args_p, a);
// Get a number (in order of reading)
// first argument of type int
int arg_int = the va_arg (args_p, int);
the printf ( "the first parameter:% D \ n-", arg_int);
// second parameter char type
char arg_char = va_arg (args_p, char );
printf ( "the second parameter: C% \ n-", arg_char);
// third parameter type double
double arg_float = va_arg (args_p, double );
printf ( "third argument:% f \ the n-", arg_float);
// end
va_end (args_p);
}
****************************************************
void main(){
func_param(3, 40, 'A', 45.3);
system("pause");
}