+ 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 }

19th Aug 2021, 8:27 AM
Samael Morningstar
2 Answers
+ 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
19th Aug 2021, 8:33 AM
Ipang
+ 2
Ipang Aha.. I see.. Thanks Ipang 🙂
19th Aug 2021, 8:34 AM
Samael Morningstar