2

It looks very similar to scope, so I really don't understand the difference. What makes storage classes different from each other? How is auto not the same as static, extern or register?

top 1 comments
sorted by: hot top controversial new old
[-] pancake@lemmygrad.ml 1 points 4 hours ago

From what I recall, register is ignored by modern compilers (it used to mean that you wanted the variable stored inside CPU registers, but nowadays compilers are smarter and know when to do that). Meanwhile, static is basically a global variable that has the scope of a local variable, while extern is a global variable that you want to explicitly tell the compiler it's defined in a different compilation unit.

this post was submitted on 03 Oct 2024
2 points (100.0% liked)

The C Programming Language

606 readers
2 users here now

Everything related to the C programming language.

founded 5 years ago
MODERATORS