edited by
269 views

1 Answer

0 votes
0 votes

First of all the syntax of the code is incorrect as either the declaration of the function should be given on the top or the function should be defined on the top itself.

Anyway, I am assuming its a "pseudo-code" kind of thing.

So, for "static" keyword.

 A static int variable remains in memory while the program is running. A normal or auto variable is destroyed when a function call where the variable was declared is over.

But the trick in this question is that “Nothing is passed in the function for every iteration of i”.

So, every time when the function will enter the “f()” part, then x will be equal to 5 every time, and it will be incremented to x++, i.e. 6 every time.

So, lastly, output printed will be 66666 as the “f()” function will be called 5 times in for loop from the "main()" function.

Related questions

627
views
1 answers
0 votes
Shivam Kasat asked Dec 15, 2018
627 views
Can anyone explain how will the second parameter gets passed ?
657
views
2 answers
1 votes
Gupta731 asked Dec 9, 2018
657 views
What is the output of the following program?$main()${$char *s[]=\left \{ ice , green , cone , please \right \};$char **ptr[]=\left \{ s+3, s ... $B$ but $C$ is provided as answer.
486
views
1 answers
0 votes
Parth Shah asked Nov 29, 2018
486 views
Which of the statements are false about keyword register'?Register keyword can be used with a pointer variable as register can have address of memory location.We ... c.Can someone explain the choice a more clearly in the above question?
599
views
1 answers
0 votes
Mahbub Alam asked Nov 19, 2018
599 views
What will be the output of the following program[Addresses of the variables are assigned continuous]#include<stdio.h>void main(){int a = 4, b = 8, c = 12, d, e, f ;int *x=&a , ... - e ;printf("%d" ; f) ;}(A)Compiler error(B) -8;(C)8;(D) 2;