Concept:- Static variable never reinitialize
and its lifetime is throughout the program.
Step1:- count(3)
print 3,1
d++;(d=2)
Push d into Stack before jumping count(2)
Step2:-count(2)
print 2,2
d++; (d=3)
Push d into Stack before jumping count(1)
Step3:-Count(1)
Print 1,3
d++; (d=4)
Print d means 4
Now d have been pushed two times into stack now they will pop and print 4 two times
Here d is static variable so latest value will be printed while poping if it is auto variable then we must have to print the value of d at the time we pushed it.
So finally the o/p is
Option A. 3 1 2 2 1 3 4 4 4