Can the main()
function in a C program return a double
data type?
If Yes, how and why?
If No, why?
The return value of main() function shows how the program exited. The normal exit of program is represented by zero return value. If the code has errors, fault etc., it will be terminated by non-zero value. In C++ language, the main() function can be left without return value.
Data type double is larger than char, hence, double return type is large enough to hold a char value and return it from the function.
Not possible with same method arguments. Method overloading is defined by argument type and count not by return type. The exception is telling you can't, so no you can't.
C++ double data type can be either fractional as well as whole numbers with values. These kinds of decimal oriented data type value can contain numbers till 15 digits and can either be prefixed with the decimal point or can be suffixed with the decimal point.
Yes. According to C standard, main() should return a int
value. But not must.
See here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With