What is the function of static in C language
This article introduces the knowledge of "what is the role of static in c language". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1. Hide, static modified functions and global variables. When static is added, the variable is hidden from other source files.
2. Keep persistence-local variables modified by static.
3. The default initialization is 0-stored in a static area.
Example
# include void test (void) {int n = 0; printf ("n =% d\ n", n); nystagmativeprintf ("nemesis + =% d\ n", n);} void test_static (void) {static int n = 0; printf ("static n =% d\ n", n); nouveau printf ("static n + =% d\ n", n);} int main () {test (); test_static () Printf ("-\ n"); test (); test_static (); return 0;} "what is the role of static in the c language" is introduced here, thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!