Global variables always have an external storage scope. Thus global variables can be accessed from other modules using 'extern' keyword.
Static variables have a local scope and can never be accessed from outside. A static variable has a file scope when declared outside the functions in a program and function scope when declared inside a function (including main function). Example:
Sample.c static int static_1;/*File Scope*/ int add_user(char *username) { static int user_count = 0;/*Function scope*/ }
About our authors: Team EQA
You have viewed 1 page out of 248. Your C learning is 0.00% complete. Login to check your learning progress.
Most popular
Questions index C Questions C++ Questions Win32 MFC COM/DCOM DLL Questions
Compilers & Editors
Download Visual Studio Download XCode Download Visual Studio Code Android studio install sdk Eclipse installer Best C compilers IDEs
Development system setup
Windows media creation tool MSDN subscription Ubuntu virtualbox
New updated posts
Why learn C? Calculate weighted average
Questions index C Questions C++ Questions Win32 MFC COM/DCOM DLL Questions
Compilers & Editors
Download Visual Studio Download XCode Download Visual Studio Code Android studio install sdk Eclipse installer Best C compilers IDEs
Development system setup
Windows media creation tool MSDN subscription Ubuntu virtualbox
New updated posts
Why learn C? Calculate weighted average