#include<stdio.h>
int main()
{
static int s;
++s;
printf("%d",s); // this printf is called and will print each
// number as the recursion is called down
if(s<=3)
main();
printf("%d",s); // <<-- this is why
// this one is called as the recursion functions
// return so it will be called with the highest
// number as many times as there were recursion.
}
To get what you want try
#include<stdio.h>
void recursive()
{
static int s;
++s;
printf("%d",s); // this printf is called and will print each
// number as the recursion is called down
if(s<=3)
recursive();
else
printf("%d",s); // call only if s > 3
}
int main()
{
recursive();
}