#include <stdio.h>
int func(void)
{
static int counter = 1;
return ++counter;
}
int main()
{
int anwser;
anwser = func() - func()*func();
printf("%d\n",anwser);
getchar();
return 0;
}
在func()函數內,我們定義了靜態變量counter,初始化值爲1.
#include <stdio.h>
int func(void)
{
static int counter = 1;
return ++counter;
}
int main()
{
int anwser;
anwser = func() - func()*func();
printf("%d\n",anwser);
getchar();
return 0;
}
在func()函數內,我們定義了靜態變量counter,初始化值爲1.