+ 1
My question is bit large.. So, kindly read the description 🙂
While declaring a function we write the return type before the function, then why don't we write the return type before calling the function?? void show(); ----- function declaration int main() { ............... show(); ----- calling the function } void show() { ........... ------ definition }
3 Antworten
+ 5
Actually we do, except as per your snippet, we don't because the function returns nothing (void).
For example:
int add( int a, int b )
{
// function body
}
Somewhere in the code ...
int result = add( 19, 36 );
You see an `int` variable is prepared there to capture return value from add() function
+ 2
Ipang Aha.. I see.. Thanks Ipang 🙂