51 | | * Inside a function: You can ''pre'' set a value to a variable ''(static int foo = 5)'', then the first time you enter on the function it will be set to 5, but the next times it not set again, it just remember the last value used |
52 | | * Outside a function (global mode): You will use it only in the actual file (compilation unit), good for optimization but you can't use it on other files |
| 51 | * Inside a function: You can ''pre'' set a value to a variable ''(static int foo = 5)'', then the first time you enter on the function it will be set to 5, but the next times it not set again, it just remember the last value used |
| 52 | * Outside a function (global mode): You will use it only in the actual file (compilation unit), good for optimization but you can't use it on other files |
| 53 | |
| 54 | Also, you can use the static variable (out of any function) in order to avoid a double-declaration of the same variable, when you use static (globally) it is limited to the file so, in another file is a different variable without any relation. |
| 55 | |