title: Query about function overloading
body: <p>When using function with same name, parameter list must differ(either in type of parameter or number of parameters used). I was just practicing with this concept. I wrote the following code.</p>
  <pre><code>   #include &lt;iostream&gt; 
      int myFunction(int n)
     { 
      return 2*n;
     }
      float myFunction(float n)
     { 
      return 3*n;
     }
      int main()
     {
      int x=myFunction(3);
      std::cout &lt;&lt; x; 
      return 0;
     }  
      
  </code></pre>
  <p>I thought I will get error because compiler will get confused which myFunction to use because I directly pass the value 3 without storing it in a particular type of variable . But I got output 6. So I tried the following code.</p>
  <pre><code>   #include &lt;iostream&gt; 
      int myFunction(int n)
     { 
      return 2*n;
     }
      float myFunction(float n)
     { 
      return 3*n;
     }
      int main()
     {
      float x=myFunction(3.3);
      std::cout &lt;&lt; x; 
      return 0;
     }  
      
  </code></pre>
  <p>As previous one worked fine, I thought this will work fine too, as 3.3 is not integer so it's clear which one to call, but this time I got compiler error saying it's ambiguous.</p>
  <p>So my doubt is why first code worked but not second one.</p>