Logo 
Search:

C Programming FAQ

Submit Interview FAQ
Home » Interview FAQ » C ProgrammingRSS Feeds

C programming practical question 93

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

Answer:

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


Answer:
0 0 0 0


Explanation:
The variable "I" is declared as static, hence memory for I will be allocated for only once, as it encounters the statement. The function main() will be called recursively unless I becomes equal to 0, and since main() is recursively called, so the value of static I ie., 0 will be printed every time the control is returned.

Share: 
 

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


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


Tagged: