#include <stdio.h>
void test() {
static int x = 10;
x++;
printf("%d\\n", x);
}
int main() {
test();
test();
test();
}
11
12
13
static int x = 10;✔ Value keeps increasing
✔ Not destroyed after function ends
#include <stdio.h>
void test() {
static int x;
x = 10;
x++;
printf("%d\\n", x);
}
int main() {
test();
test();
test();
}