Sunday, 15 September 2013

c++ - how to use logical operator directly into the user defined variables -



c++ - how to use logical operator directly into the user defined variables -

#include <iostream> using namespace std; int main() { // code goes here int x=1; int y; y=x&&10; cout<<y; homecoming 0; }

the output 1.

how value stored in y? operation of &&? please explain.

y=0 if set 0 instead of 10 or assign 0 x. if values of left hand operand , right hand operand both non-zero y=1 both represents true. if 1 of operand 0 y=0 0 represents false.

c++

No comments:

Post a Comment