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/16/2018 3:11:29 AM
Ketan Lalcheta4 Answers
New Answerthe compiler takes in double as default. Its good practice to specify floats as 2.03f with the f at the end of the number
「HAPPY TO HELP」 true Double and float void Test(double d) {cout << "1";} void Test(float e) {cout << "2";} int main() { Test(1.0f); // calls float function }
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
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
SoloLearn Inc.
4 Embarcadero Center, Suite 1455Send us a message