#include <iostream>
using namespace std;
void pri(int x);
void pri(float x);
int main()
{
float x = 10.2;
pri(10.2);
}
void pri(int x) {
cout << "int" << endl;
}
void pri(float x) {
cout << "float" << endl;
}
In the above code when 10.2 is given as the argument, it gives a compile error and when it is given x as the argument that is also the 10.2, it works fine. What is happening here?