"HARD WORK BEATS TALENT WHEN TALENT DOSEN'T WORK HARD."
"HARD WORK BEATS TALENT WHEN TALENT DOSEN'T WORK HARD."
Return is a Keyword. It used to return the some value in function. Return is not mandatory. It's up to you whether you want to return value or not. It can be used in two ways.
A function may return a value or may not. It depend on function data type. Whether you are using int, float, char, double or void. Here void data type return nothing and int, float, char, double data type return 0 or 1.
return_type function_name(parameter optional); { body of statement; return ; }
To return the some value we use return statement. Return is not mandatory. It's up to you whether you want to return value or not.
If you don't write any return type before main function then by default main function is int.
main function always return null value with void data type. If you don't use void data type before the main function then by default it will return int. using main function without any data type it will give error, return type is required.
main() //no void, then by default it return int { return 0; }
int main() { printf("Line 1\n"); f1(); //function caller printf("F1 after"); } void f1() //function declaration { printf("Return f1 function."); }
Line 1 Return f1 function. F1 after