please explain me how the bool function operated…like i didnt get the turnery operator
#include
using namespace std;
bool isodd(int n)
{
int lsb = (n & 1) == 0 ? 0 : 1; // turnery operator
// lsb == 0 // false
// lsb == 1 // non zero value means true
return lsb;
}
int main()
{
int n;
cin >> n;
if (isodd(n) == true)
{
cout << n << " is odd" << endl;
}
else
{
cout << n << " is even" << endl;
}
return 0;
}