How does a function definition differ from function declaration?
Answers
Function declaration means actual work of function what will be done by that function.
Function definition means the data type, parameters, and function name it can be written anywhere in a program ended by a terminator {;}.
Function definition different from function declaration:
A function is declared to inform the compiler about the name and type of the variable, initial value it takes etc. This implies the properties of the variable are detailed by the function declaration. So, any identifier must be declared before using it in the programs.
The space to be used in the memory is decided by a function definition. It defines the space to be allotted in the memory device. It provides the actual body of the function. The way the variable is defined, it will be stored accordingly in the memory i.e., if it is an integer in C language, it will be stored as numbers with 4 bytes in memory.