335 views
1 votes
1 votes

1 Answer

0 votes
0 votes

Anwer is B.

A) scope of the static variable is local to the function in which it is defined . if you want to have global scope you should use extern.(global variable) so this is wrong .

B) static variable is stored in heap not in stack . It can live throught the progam execution . this option is correct.

C)static variable can't be modified when passing as argument in function . If you want to modify it you have to pass the base address of the variable (using pointers) .

https://www.tutorialspoint.com/cprogramming/c_storage_classes.htm

Related questions

1 votes
1 votes
0 answers
1
srestha asked Mar 6, 2019
780 views
void find(int x){ static int i=10,y=0; y=y+i; for(i;i>0;i=i-10){ if(x!=0) find(x-1); else{ printf("%d",y); } } }What will be output printed for find(4)?
1 votes
1 votes
0 answers
2
srestha asked Mar 2, 2019
1,199 views
An OS uses virtual memory with paging technique for memory allocation. Which of the following searching technique on given data structure use locality of reference?Linear...
0 votes
0 votes
0 answers
3
register_user_19 asked Jan 10, 2019
441 views
What is the output of the following code ?void f(int a, int b){printf(“%d”,a+b);}void main(){f((2,3),4);}675None of these
0 votes
0 votes
1 answer
4
Na462 asked Jun 29, 2018
605 views
According to me Option D.Because it should be an error because *("INDIA" + 2 ) = 'D' and we are doing 'D' = 'I' which is not valid so Error ???But answer is C