Guys! is there any certain difference between function definition & function declaration?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Guys! is there any certain difference between function definition & function declaration??

13th Jun 2016, 4:16 PM
M Ahmed Shehry
M Ahmed Shehry - avatar
4 Answers
+ 5
Yes there is ¡¡ There is actually 3 parts of using functions 1. Function declaration : It is used to tell the compiler, that there is something like this function which you are going to use in your program. It also checks the function with your prototype. It is generally declared before the main function as global or in a class nas a member function. 2. Function definition : It is the only area where actual working of function is mentioned. It can be defined anywhere once declared. It should match the prototype declared. 3. Function call : It is the method by which you want a particular function to get executed. This is done by giving the function name with all its parameters or argument in parentheses. This call can be from the main function or from another function. If a function calls itself then it is called recursion.
13th Jun 2016, 5:56 PM
Roshan Kumar
Roshan Kumar - avatar
+ 1
Off course there is!! Function definition is the part where the function is defined i.e. the program to perform by the function is written. Function declaration is the line where the function is called i.e. it is declared in the main or inside a class.
13th Jun 2016, 5:16 PM
Satan 666
Satan 666 - avatar
+ 1
function definition means you are making the structure of the function statement and the function declaration it's just you thought that means is Foundation how your function would be here like what is its behaviour what is it Outlook what is character understand and function definition the set of rules like function will follow to reach is goal. I hope you understand
17th Jun 2016, 5:55 AM
Ankit Kumar
Ankit Kumar - avatar
0
Function declaration means to introduce it. Function definition means detail about what task it will perform.
22nd Jun 2016, 4:23 AM
Himanshu singh Bisht
Himanshu singh Bisht - avatar