ExamVeda
Login
Home
This question belongs to C Program Function
Function
?

What will be the output of the following program code?
main()
{
      static int var = 5;
      printf("%d ", var--);
      if(var)
            main();
}

Answer & Solution
Correct Answer: Option B

When static storage class is given, it is initialized once. The change in the value of a static variable is retained even between the function calls. Main is also treated like any other ordinary function, which can be called recursively.

Examveda
Question posted by Examveda
Community

Join the Discussion

1 Comment
Divya Shree
Divya Shree 7 years ago
Output of #include
Mani()
{ Int x,y=10;
x=y*NULL;
Printf("%d",x);
}