Asked in C Programming
C Programming

What does static mean in C?



User Avatar
Wiki User

The keyword "static" in C has a slightly complicated meaning, depending on where it is used. It generally denotes static storage, meaning that it is allocated in the static data area of the program, and not on the stack or heap. Also, it generally limits the visibility of the name to a certain area of the code.

If used on a variable or function of global scope, then it generally means that the function or variable can only be used by other functions within the same file, as opposed to "extern" which means that the variable and function can be used from other files.

If used on a local variable within a function, it means that the variable maintains its value between function calls (since it is allocated statically and not on the stack).