static int count = 0;
int func()
{
count ++
// do your work
// recursive call
}
Make static variable which will keep the total number of calls made to functions.
And in this case you don't have to make count
as global making it local static into function is enough because static variable retains it's value as static
has file scope.