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;
}
  1. A.

    2n + 8

  2. B.

    2n + 4

  3. C.

    2n + 2

  4. D.

    2n

Attempted by 64 students.

Sign up free to check your answer

Sign up free

Explore the full course: C Language

Loading lesson…