static in C — a practical guide to C static keyword with clear examples you can reuse in real projects.
C Programming Tutorial Series (70/102). Prefer one article? Read the complete C programming tutorial.
Short description
static locals keep values between calls.
static local
void tick(void) {
static int n = 0;
n++;
printf("%dn", n);
}