how function overloading works
<pre><code>int add(int a,int b)
{
     cout&lt;&lt;"1"&lt;&lt;endl;
     return a+b;
 }
 int add(int a,char c)
 {
       cout&lt;&lt;"2"&lt;&lt;endl;
      return a+c;
 }
int main()
{
          cout&lt;&lt;add(10,20)&lt;&lt;endl;    //1
          cout&lt;&lt;add(10,'a')&lt;&lt;endl;   //2 
          cout&lt;&lt;add('a','b')&lt;&lt;endl;  //3 
 }
</code></pre>

<p>in the above code the first function calls function add(int,int) ,the second function calls function add(int,char).
the third function call should result as error but it calls the function add(int,char).
can any one explain why.</p>
