I want to know whether the statement int i; is a declaration or a definition.
It seems that if a variable is not initialized outside the function, it is declared, but inside the function it must be defined. Is this really the case?
If I write this statement multiple times outside the function, it compiles.
If I write multiple statements inside the function, it does not compile.
>Solution :
If no storage-class specifier is provided, the defaults are:
- extern for all functions
- extern for objects at file scope
- auto for objects at block scope
For any struct or union declared with a storage-class specifier, the storage duration (but not linkage) applies to their members, recursively.
Function declarations at block scope can use extern or none at all. Function declarations at file scope can use extern or static.
Function parameters cannot use any storage-class specifiers other than register. Note that static has special meaning in function parameters of array type.
so you should know "storage duration" and "linkage of objects"