Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

ISRO | ISRO CS 2017 – May | Question 62

  • Difficulty Level : Hard
  • Last Updated : 21 Mar, 2018

What is the output of the following program?

#include 
int tmp=20;
main( )
{
printf("%d ",tmp);
func( );
printf("%d ",tmp);
}
func( )
{
static int tmp=10;
printf("%d ",tmp);
}

(A) 20 10 10
(B) 20 10 20
(C) 20 20 20
(D) 10 10 10


Answer: (B)

Explanation: Main() is the entry section of the program. First print statement will print the value of tmp = 20. Then after the function is called the 10 will be printed. After that control returns to the main function and again 20 will be printed.
So, option (B) is correct.

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!