static-- static variables

Keyword "static" useful in the following code:

In the body of the function, the count variable is declared as static variables, when counter function is called, the value of the count is unchanged;

 

 

and so

The results of the first code graph 15

[root@localhost interview]# gcc static.c
[root@localhost interview]# ./a.out
j = 15

[root@localhost interview]#


Second result code of FIG. 5 is

[root@localhost interview]# gcc static.c

[root@localhost interview]# ./a.out

j = 5

[root@localhost interview]#


 

Released three original articles · won praise 0 · Views 2637

Guess you like

Origin blog.csdn.net/qq_32942215/article/details/64997133