in Programming edited by
92 views
0 votes
0 votes

 

#include<stdio.h>
int K = 10;
int main()
{
foo();
foo();
return 0;
}

int foo()
{
static int k= 1;
printf("%d ",k);
k++;
return 0;
}

What is the output of the above code snippet?

  1. $2,3$
  2. $1,2$
  3. $1,3$
  4. $2,4$
in Programming edited by
by
92 views

1 Answer

0 votes
0 votes

ans B

1st time foo is called then k=1     pf(1)    k=2

2nd  time foo is called then k=2     pf(2)    k=3

op=1,2

Answer:

Related questions