The value of j at the end of the execution of the following C program. C int…

GATE · 2000 · CS · Question 2 subparts

The value of j at the end of the execution of the following C program.

C

int incr(int i)
{
   static int count = 0;
   count = count + i;
   return (count);
}
main()
{
   int i,j;
   for (i = 0; i <=4; i++)
      j = incr(i);
}
  1. A.

    10

  2. B.

    4

  3. C.

    6

  4. D.

    7

Attempted by 254 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…