+ 4

can we return float value???

in the function like int main() can we return float value????? why??

29th May 2017, 4:57 AM
Bhavin Kanzariya
Bhavin Kanzariya - avatar
5 Respostas
+ 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.
29th May 2017, 5:00 AM
Rrestoring faith
Rrestoring faith - avatar
+ 7
no because int main () will return a int.
29th May 2017, 7:50 AM
NimWing Yuan
NimWing Yuan - avatar
+ 4
yup thank you very much
29th May 2017, 5:11 AM
Bhavin Kanzariya
Bhavin Kanzariya - avatar
+ 4
so can we take float main(). ????????
29th May 2017, 5:15 AM
Bhavin Kanzariya
Bhavin Kanzariya - avatar
+ 4
no...
29th May 2017, 5:20 AM
jay
jay - avatar