+ 4
can we return float value???
in the function like int main() can we return float value????? why??
5 Answers
+ 8
Review return types.
A float is not an int, and the return value of the method is an int.
So no you can't return a float. The function must have a float return type.
Like:
float main(){
return 0.0;
}
The main method can't be a float though. So this still wouldn't work.
Why can't it be a float?
The way it was designed is to just return 0 to say it's a valid execution. No point in taking larger float values.
+ 7
no because int main () will return a int.
+ 4
yup thank you very much
+ 4
so can we take float main(). ????????
+ 4
no...