+ 2

What is the difference b/w func declarion n funct defination?

6th Jul 2016, 11:58 AM
Anshuman Sharma
Anshuman Sharma - avatar
4 Réponses
+ 4
function declaration tell the compiler about function name,return type and parameter while function definition is the body or block of statement to perform task
6th Jul 2016, 7:10 PM
Sunusi Muhammad Raji
Sunusi Muhammad Raji - avatar
+ 3
when you declare prototype of the fxn then that is known as function declaration. like - void Print(); // fxn declaration Fxn definition: when u write actual implementation of the fxn. like void Print() { cout<<"Hello world"; }
6th Jul 2016, 5:19 PM
Nakul Kumar
Nakul Kumar - avatar
+ 1
a function declaration is just saying "hey, I'm a function, i haven't been defined yet but I'm here" this is used when in headers,classes, and placing a function underneath of main.cpp. a definition is the actual creation of what that function is and does
6th Jul 2016, 5:07 PM
destro
0
"Definition" refers to the place where variable is created or assigned storage; "declaration" refers to places where the nature of variable is stated but no storage is allocated.
7th Jul 2016, 2:15 PM
Nikola Dedović