the static identifier:
In C, if a local variable is declared static, a separate memory
location is allocated for that variable. This variable retains the
value between function calls, like a global variable. So next time when
a function is called again it finds the old value. Also a local static
variable is initialized only once.
但是static的变量值是可以改变的。 只是赋值只语句只执行一次。
例子:
阅读(347) | 评论(0) | 转发(0) |