Lauguage : C++
I have to make function 'add' overloaded.
'add' function has array a[] as parameter.
I wrote my code but it doesn't work.
There is no error or caution but it doesn't start.
What is the problem on my code?
int add(int a[], int n, int b[])
{
int sum = 0;
for (int i = 0; i < n; i++)
sum += (a[i] + b[i]);
return sum;
}
int add(int a[], int n=5)
{
return add(a, n, NULL);
}
a[]is an array parameter? That is misleading, because it really is a pointer. Arrays aren't pointers and it is good to understand that early on.NULLdoes? Hint: it's not an array of zeroes.