In C Programming (Multiple Choice Question 2 ) Static Storage Class

#include<stdio.h>
void main()
{
static num = 4;
printf("%d ",--num);
if(num)
   main();
}


Options : 
  1. 43210
  2. 3210
  3. Infinite Times 4
  4. Compile or Run Time Error



Why & How ?
  • Pre Increment : Refer Here
  • Storage Class is Static
  • Static Storage class in initialized Once
  • Static Storage class can be Modified number of times
  • During Execution Static num is Initialized to 4.
  • We are printing number as (--num) i.e [ First Decrement then Print ]
  • During Second Call to Main Value of num is 3 instead of 4.
Bookmark & Share

0 comments

Post a Comment

Your Feedback :This is Growing Site and Your Feedback is important for Us to improve the Site performance & Quality of Content.Feel Free to contact and Please Provide Name & Contact Email

Followers