initial import
[staff/goc4/2018bti7061.git] / c-3-libraries / examples / c-variables / static1.c
1 #include <stdio.h>
2
3 int counter(void); /* Prototype of the function */
4
5
6 main(){
7 counter();
8 counter();
9 counter();
10 counter();
11 counter();
12 printf("Counter = %d\n",counter());
13 /* Output
14 Counter = 6
15 */
16 }
17
18 int counter(void){
19 static int i=0;
20 i++;
21 return i;
22
23 }
24