What is wrong with the following function definition? void fill(const int a[], i
ID: 3574785 • Letter: W
Question
What is wrong with the following function definition?
void fill(const int a[], int size)
{
for (int i = 0; i < size; i++)
{
a[i] = 0;
}
return;
}
The function cannot change the array parameter.
The array should be passed as a call-by-reference, not call-by-value.
The for loop causes an out-of-bounds indexing error.
Nothing, the code works fine as is.
What is wrong with the following function definition?
void fill(const int a[], int size)
{
for (int i = 0; i < size; i++)
{
a[i] = 0;
}
return;
}
The function cannot change the array parameter.
The array should be passed as a call-by-reference, not call-by-value.
The for loop causes an out-of-bounds indexing error.
Nothing, the code works fine as is.
Explanation / Answer
Answer: The function cannot change the array parameter.
The function cannot change the array parameter because array declared const. if we declared const on any variable, w we can not change that value.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.