There are two differences between a declaration and a definition:
- In the definition of a variable space is reserved for the variable and some initial value is given to it, whereas a declaration identifies the type of the variable.
- Redefinition is an error, whereas, redeclaration is not an error.
Example of Definition:
int a=10;
char ch='A';
Example of Declaration:
extern int a;
extern char ch;
No comments:
Post a Comment