Does this confuse you less?
The only difference here is that the variable called i now has a scope that extends to the whole file, and not just the foo() function.Code:#include<stdio.h> static int i = 0; void foo () { printf("i = %d \n", i); i = 1; printf("i = %d \n", i); i = 2; printf("i = %d \n", i); i = 3; printf("i = %d \n", i); } int main () { foo (); printf("\n"); foo (); return 0; }