Reputation: 543
return cout<<"NO"<<endl,0;
I have a few questions in this code. I've already tried searching for an explanation but none seems to explain it clearly. Does 'cout <<' return something? If so, does this code means that it could return either of the two values? If so, how does it know which value to return?
Upvotes: 0
Views: 85
Reputation: 136238
Does
cout <<
return something?
It returns std::ostream&
reference to cout
, unless the user overloaded operator<<(std::ostream&, T)
to return something else.
If so, does this code means that it could return either of the two values?
No, the code always returns 0. Unless the user overloaded operator,
.
If so, how does it know which value to return?
The built-in comma operator always returns the second value.
Upvotes: 4