1.

What Is The Difference Between Declaration And Definition ?

Answer»

There are basically two differences between declaration and definition : 

  • In declaration no space is RESERVED for the variable, declaration only tells about the 'type' of the variable we are using or we will be using int he program.
  • Definition on the other HAND reserves the sapce for the variable and some initial value is given to it.
  • Another major DIFFERENCE is that redeclaration is not an error whereas redefinition is an error,
  • In simple WORDS, when we declare no space is reserved for the variable and we can redeclare it in the program
  • On the other hand, when we define a variable some sapce is reserved for it to hold values PLUS some initial value is also given to it, apart from it we cannot give another definition to the variable, i.e. we cannot define it again.

Example: 

extern int x -> is a declaration whereas int y is definition.

There are basically two differences between declaration and definition : 

Example: 

extern int x -> is a declaration whereas int y is definition.



Discussion

No Comment Found