Explanation
In the above programs, increment() function is called three times from the main.

The only difference is the storage class of variable x.

Like auto variables, static variables are local to the function in which they are declared but the difference is that the storage duration of static variables remains until the end of the program as mentioned earlier.

External Storage Class

External variables are declared outside the body of the function. If they are declared in the global declaration section, it can be used by all the functions in the program.