This function returns a value even when it shouldn't.
#include<iostream>
using namespace std;
int foo(int a,int b)
{
    if(a>b)
        return a;
    else if(a<b)
        return b;
}
int main()
{
    int x=7,y=7;
    cout<<foo(x,y);
    return 0;
}
The output is:
7
Also it produces proper output only on a GCC compiler (I used Dev C++). Turbo C produced garbage value. Can someone explain how this happens?
 
    