+ 5
Double and float
void Test(double d) {cout << "1";} void Test(float e) {cout << "2";} int main() { Test(1.0); // calls double function } I am not aware how to call Test from main for float... I mean to say what should be passed as value for float type function call...
3 Answers
+ 3
Man Ketan Lalcheta you can use float casting to if you are sure about calling function is passing float data.
Test((float)1.0); // calls float function
+ 2
its better practice to forget about float and always use double. Internally java casts every float to a double and then converts them back anyway
+ 2
ćļ¼Øļ¼”ļ¼°ļ¼°ļ¼¹ ļ¼“ļ¼Æ ļ¼Øļ¼„ļ¼¬ļ¼°ć true
Double and float
void Test(double d) {cout << "1";}
void Test(float e) {cout << "2";}
int main()
{
Test(1.0f); // calls float function
}