For the longest time I thought there was no reason to use the static
keyword in C, because variables declared outside of block-scope were implicitly global. Then I discovered that declaring a variable as static
within block-scope would give it permanent duration, and declaring it outside of block-scope (in program-scope) would give it file-scope (can only be accessed in that compilation unit).
So this leaves me with only one keyword that I (maybe) don't yet fully understand: The auto
keyword. Is there some other meaning to it other than 'local variable?' Anything it does that isn't implicitly done for you wherever you may want to use it? How does an auto
variable behave in program scope? What of a static auto
variable in file-scope? Does this keyword have any purpose other than just existing for completeness?