Code:
#include<iostream>
using namespace std;
bool testsame(int val1, int val2)
{
if(val1==val2)
return true;
else
false;
}
int main()
{
if(testsame(12, 23))
cout<<"Both values are same"<<endl;
else
cout<<"Values are not same"<<endl;
cin.get();
}
and my output is
Code:
Both values are same
but the output is wrong. i know the problem where it is. it in the function testsame
Code:
return true;
else
false;
}
when i put return in front of false everything seems tom work fine. i get correct answer. i dont understand why it is?? can any one tell me why this happens if i dont put return keyword keyword
thank you
s.s.harish