Hii friends,
In my this post I want to share wid you something on one of the most famous middle-level programming languages, C language.In C language, we generally come across the use of declaration and definition whether of a function, a variable or may it be structures.In case of functions and other user-defined c-tokens, this difference is clear-cut.But when it comes to the variable, both looks the same.So, the meaning of definition and declaration for variables is as follows:
Declaration: It specifies the type and name of the variable.
Definition: It specifies the type and name as well as the memory location on computer memory where the variable has been allocated storage.
Example:
int name;
It is a declaration of variable name.
extern int name;
It is a definition of variable name (excluding the case of multiple-file program).
No comments:
Post a Comment