How to use static to modify local static variables in C language
This article mainly shows you "how to use static to modify local static variables in c language". The content is simple and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to modify local static variables with static in c language".
1. The scope is limited to the interior of the function. After leaving the function, it is invalid. * * Life cycle * * until the end of the program.
2. Whether it is an ordinary local variable or a static-modified static local variable, the scope is only valid within the function.
Example
# include int func1 () {int x = 5; x variables; printf ("function func1 local variables x =% d\ n", x); return 0;} int func2 () {static int x = 10; x variables; printf ("function func2 static local variables x =% d\ n", x); return 0;} int main () {for (int I = 0 return I)