KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
From External Variables Wiki : If neither the extern keyword nor an initialization value are present, the statement can be either a declaration or a definition. It is up to the compiler to analyse the modules of the program and decide. I was not able to fully grasp the meaning of this statement with respect to C. For example, does it imply that: int i; is not necessarily a declaration (as I have been assuming until now), but could be a definition as well (by definition of Definition & Declaration on the same webpage, no puns intended)? In a nutshell, is the above statement: a. just a declaration, or b. declaration + definition? Reference: Variable declaration and definition Summary of answers received: Declaration Definition Tentative Definition Initialized int i; (inside a block) Yes Yes No No int i=5; (inside a block) Yes Yes No Yes(to 5) int i; (otherwise) Yes No Yes Yes(to 0) extern int i; Yes No No No All definitions are declarations but not vice-versa.
Tags (comma-separated)
Save Edits
Cancel