The output would be:
static int var = 7;/* This runs only once*/
// call foo 4 times
As you may know, local variables terminate their lifetime, when the function they live in terminates.
var, in our example, is a static variable though. As a result, it is "immortal". It won't die, no matter how many times the function the terminates. It is created once and dies once, when your program ends.
As a result, the value of the variable is remembered among function calls!
But, this line of code
runs only once, because the static variable is created one time only!
static int var = 7;
Notice, that static keyword can also been found for limiting the scope of a variable, making her have in -file scope. However, the static keyword has not the same effects on these situations.
//Also, Sam, welcome to the forum