学习 static 定义静态变量的用法

学习 static 定义静态变量的用法

#include <stdio.h>
void foo()
{
    static int x=0;
    x++;
    printf("%d\n",x);
}
int main()
{
    foo();
    foo();
    foo();
    return 0;
}

posted on 2023-06-11 20:49  wessf  阅读(10)  评论(0编辑  收藏  举报