新人容易忽略的问题2C/C++ code#include stdio.hstatic int i 0int fun(){static int i 5return +
新人容易忽略的问题2
C/C++ code
#include <stdio.h>static int i = 0;int fun(){ static int i = 5; return ++i;}int main(){ int test; test = fun(); test = fun(); test = fun(); printf("%d\n",test); return 0;}1、最后test值是多少2、在函数fun中 i是定义还是声明 3、静态变量的生命周期