+ 2
What is the difference b/w func declarion n funct defination?
4 Antworten
+ 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
+ 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";
}
+ 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
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.