1.

What Is The Difference Between Declaring A Variable And Defining A Variable?

Answer»

Declaration is done to tell COMPILER the data type of the variable, and it INHERENTLY meant that somewhere in this scope, this variable is DEFINED or will be defined. And defining a variable MEANS to allocate SPACE for that variable and register it in the stack memory. For example:
extern int decl1; /* this is a declaration */
int def2; /* this is a definition */

Declaration is done to tell compiler the data type of the variable, and it inherently meant that somewhere in this scope, this variable is defined or will be defined. And defining a variable means to allocate space for that variable and register it in the stack memory. For example:
extern int decl1; /* this is a declaration */
int def2; /* this is a definition */



Discussion

No Comment Found