Consider the following piece of code. What will be the space required for this…
Accenture · 2023
Consider the following piece of code. What will be the space required for this code? (Assume sizeof(int) = 2 bytes.)
int sum (int A[], int n)
{
int sum = 0, i;
for (i = 0; i < n; i++)
sum = sum + A[i];
return sum;
}- A.
2n + 8
- B.
2n + 4
- C.
2n + 2
- D.
2n
Attempted by 64 students.
Sign up free to check your answer
Sign up freeLoading lesson…