icp/oer/courses/c-basics/sections/03-functions/10-static/program.c

16 lines
220 B
C
Raw Normal View History

2018-05-05 22:18:02 +00:00
#include <stdio.h>
void counter()
{
static int i = 0;
i++;
printf("I was called %d times.\n", i);
}
int main(int argc, const char *argv[])
{
for (int x = 0; x < 20; x++)
{
counter();
}
}