I am confused with the output of below code when I execute it.
Code:
int add(int a, int b)
{
cout<<"inside int add function"<<endl;
return a+b;
}
float add(float a, float b)
{
cout<<"inside float add function"<<endl;
return a+b;
}
int main()
{
cout<<add(10.0f,20.0f)<<endl<<add(20,50);
return 0;
}
output:
inside int add function
inside float add function
30
70
I dont understand the order of cout messages are getting printed in console. But I expected the output of above program like below
inside float add function
30
inside int add function
70
Could someone explain about above behavior.