+ 4
What happen if we don't use return statement?
6 Answers
0
If your function doesn't return anything, set the return type to void.
void print(int n) {
cout << n;
}
Similarly, if it doesn't take any parameter, put void in the parameter field.
int get42(void) {
return 42;
}
0
In the main function, nothing may happen but it will be difficult for you to even notice a logical error in
your code since you wouldn't be able to see the required value returned after program execution.
0
it doesn't return a particular value which u want in the main function i.e if u doing a calculation in ur function and when u pass an argument to the function ..it will do the calculation and it wont return the answer to place where u called..
0
si
0
diam
- 1
it doesn't return a particular value which u want in the main function i.e if u doing a calculation in ur function and when u pass an argument to the function ..it will do the calculation and it wont return the answer to place where u called..