GATE | GATE-CS-2000 | Question 43

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

filter_none

edit
close

play_arrow

link
brightness_4
code

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);
}

chevron_right


(A) 10
(B) 4
(C) 6
(D) 7


Answer: (A)

Explanation: See question 2 of https://www.geeksforgeeks.org/c-language-set-1/

Quiz of this Question



My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.