In C++ please.
1. Explain what default parameter values are. Describe "function overloading" and "function call resolution". Simplify the following code using default parameter values. int *setUpArray(int size, int value){ int *a = new int[size]; for (int i=0; i < size; ++i) a[i] = value; return a; } int *setUpArray(int size){ int *a = new int[size]; for (int i=0; i < size; ++i) a[i] = 0; return a; } int *setUpArray(){ int *a = new int[100]; for (int i=; i < 100; ++i) a[i] = 0; return a; }
default values are given to parameters
if we dont pass value for that parameter than default value
will be assigned
function overloading is having same function with different type of
order
of parameters
// if we dont pass the size and value than
// by default it will create the with default vaues 100 and 0
int *setUpArray(int size=100, int value=0){
int *a = new int[size];
for (int i=0; i < size; ++i) a[i] = value;
return a;
}
NOTE : PLEASE COMMENT BELOW IF YOU HAVE CONCERNS.
I AM HERE TO HELP YOUIF YOU LIKE MY ANSWER PLEASE RATE AND HELP ME IT IS VERY IMP FOR ME
Get Answers For Free
Most questions answered within 1 hours.