What would be the advantage of using a static storage class in front of a global variable in a C program?
A global variable is a variable that can be accessed in the source file where it is declared.
static variable is a variable that indicates the lifetime of the variable
It is advantage to use static storage class inside a function.
I followed several tutorials on websites and youtube but I don't understand what can be the advantage of using static storage classes in front of global variables. Do you use static global variables in your program?
A global variable is a variable that can be accessed in the source file where it is declared.
static variable is a variable that indicates the lifetime of the variable
C:
static int variable_name;
int main ( ) {
......
}
I followed several tutorials on websites and youtube but I don't understand what can be the advantage of using static storage classes in front of global variables. Do you use static global variables in your program?