Is the following statement a declaration or definition? extern int i;
[A].
Declaration
[B].
Definition
[C].
Function
[D].
Error
Answer: Option A
Explanation:
Declaring is the way a programmer tells the compiler to expect a particular type, be it a variable, class/struct/union type, a function type (prototype) or a particular object instance. (ie. extern int i)
Declaration never reserves any space for the variable or instance in the program's memory; it simply a "hint" to the compiler that a use of the variable or instance is expected in the program. This hinting is technically called "forward reference".
extern here refers to type of storage class in c . If you have 2 files say A and B and you want to access the global variable declared in A to be appearing in B then u culd do so by adding extern keyword . Refer to google if not satisfied .