Shouldn't storage classes be taught early in a C class or book?
I notice that a lot of books, even some of the better ones, covert it toward and end of the book and some books just add it as an appendix. I would teach it together with variables. This is so foundational and I think unfortunately many do not make it that far in a book. Now that auto has a different meaning (vs being optional) it may confuse people that didn't realize it has always been there.
for example: C Programming: A Modern Approach
18.2 Storage Classes 401
Properties of Variables 401 The auto Storage Class 402 The static Storage Class 403 The extern Storage Class 404 The register Storage Class 405 The Storage Class of a Function 406 Summary 407
@DeadMG, I fear I didn't state my question properly. Everyone always uses storage classes. Every single variable in a C program has a storage class. The thing is that some of the keywords were made optional because, for example,
int i; = auto int i;
The reason I ask is because I've seen code so bad where variables are declared at the top of a program to be made available to a function and not lose its value when it goes out of scope but only one function needed it. Then, by default the variable's storage class is "extern" int i; but they may not know since extern is assumed by the compiler. What they should have done is to declare it in the function that needed it as static, static int varToKeepValue; that way you achieve the desired goal of preserving the variable's value when the function goes out of scope throughout the execution of the program, while also making the code more readable.
btw: I'm interested in this, please email me your thoughts if this question gets closed.
On another note: you have a very odd approach... keep learners ignorant? I think is because they don't have that information that the language is not used properly. It's not like not letting kids run with knives. My approach is, learn the language inside and out that will let you use it properly.