Logo 
Search:

C Programming FAQ

Submit Interview FAQ
Home » Interview FAQ » C ProgrammingRSS Feeds

C programming practical question 4

  Shared By: Adah Miller    Date: Jan 24    Category: C Programming    Views: 121

Answer:

main()
{
static int var = 5;
printf("%d ",var--);
if(var)
main();
}


Answer:
5 4 3 2 1


Explanation:
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.

Share: 
 

Didn't find what you were looking for? Find more on C programming practical question 4 Or get search suggestion and latest updates.


Your Comment
  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].


Tagged: