Mega Code Archive

 
Categories / C++ Tutorial / Data Types
 

Ambiguous function call when data type casting from int to double and float

#include <iostream> using namespace std; float myfunc(float i); double myfunc(double i); int main() {   cout << myfunc(10.1) << " "; // unambiguous, calls myfunc(double)   //cout << myfunc(10); // ambiguous   return 0; } float myfunc(float i) {   return i; } double myfunc(double i) {   return -i; } -10.1 "