Hi i want to pass from on to ten arguemnts to a function which will be saved in array.
function( 4, 3, 5); //calling function and passing arguments to it.
void function(int array[10])
{
cout<<array[0]; // = 4
cout<<array[1]; // = 3
cout<<array[2]; // = 5
cout<<array[3]; // = NULL or 0 or sth else
}
basically I want to have the oportunnity to pass as many arguments as I want to, no more , no less.
It can't be like this.
function( 4, 3, 5); //calling function and passing arguments to it.
void function(int x1=NULL , int x2=NULL , int x3=NULL ,int x4=NULL , int x5=NULL)
{
for (int i=0 ; i<10;i++)
{
array[i] = x1; // x2 , x3 and so on ...
}
cout<<array[0]; // = 4
cout<<array[1]; // = 3
cout<<array[2]; // = 5
cout<<array[3]; // = NULL or 0 or sth else
}
It's more complicated program than this example, so I NEED it to be array.