#include <stdio.h>
void count(int );
void count(int n)
{
    int d = 1;
    printf("%d ", n);
    printf("%d ", d);
    d++;
    if(n > 1) count(n-1);
    printf("%d ", d);
} 
int main(void) {
    count(3);
    return 0;
}
Output : 3 1 2 1 1 1 2 2 2
#include <stdio.h>
void count(int );
void count(int n)
{
    static int d = 1;
    printf("%d ", n);
    printf("%d ", d);
    d++;
    if(n > 1) count(n-1);
    printf("%d ", d);
} 
int main(void) {
    count(3);
    return 0;
}
Output : 3 1 2 2 1 3 4 4 4
In both the outputs, I am unable to get the difference between last 3 digits in the output, i.e, 444 and 222.
I know that static declaration has static allocation at compile time, so its value is retained throughout the program and local/auto variable is destroyed as soon as function call ends.
But, even though I am confused in the last 3 digits only as I can't interpret them based on the above information ?
 
     
     
     
     
    