I see a difference between global and static variables These two variables do the same thing. But the theory says that these two are different
1Code:#include <stdio.h>
static int i = 0;
void m() {
static int j = 0;
j++;
printf("%d \n", j);
}
int main() {
m();
m();
i++;
printf("%d \n", i);
i++;
printf("%d \n", i);
return 0;
}
2
1
2