Back to notes -- Keyboard shortcut: 'u'  previous -- Keyboard shortcut: 'p'  next -- Keyboard shortcut: 'n'  Slide program -- Keyboard shortcut: 't'    An ambiguity between 'float to int' and 'float to long int'.Lecture 2 - slide 27 : 42
Program 3
#include <iostream>
#include <string>

using namespace std;

void f(int i){
  cout << "f(int)" << endl;
}

void f(long int i){
  cout << "f(long int)" << endl;
}





int main(){
  float c = 5.5;
  f(c);             // error: call of overloaded  f(float&)  is ambiguous
                    // note: candidates are: void f(int)
                    // note:                 void f(long int)

}

// This example is continued in the next program...