Many, many problems, you should definitely read a C++ book or reread some tutorials
Where did you define count_of_function_calls
?
Nowhere, that's why the compiler is complaining. You always have to declare variables before you use them:
int count_of_function_calls = 0;
Note that in your case, because you want to value of count_of_function_calls
to be incremented for each function call, you should declare it as a global variable (this is not recommended, consider using something else).
A global variable is declared outside of any scope, in your case, you could for example defined it just above void fun ()
.
void fun ();
declares a function (called fun
), taking no arguments and returning void
. It doesn't call the function fun
. If you want to call a function, you don't have to specify the return type:
//Call function 'fun'
fun();