int a = 1, b = 2;
int c = a | b; 
int d = a || b;
Ans: value of c will be 3 and d will be 1

c  = (binary 01) OR (binary 10)
   = (binary 11)
   = 3
   
d   = 1 (Logical OR) 2 
    = (1 is not FALSE) Logical OR (2 is not FALSE) 
    = (TRUE) Logical OR (TRUE) 
    = TRUE 
    = 1

You have viewed 1 page out of 248. Your C learning is 0.00% complete. Login to check your learning progress.

 Vote 0

Similar topics related to this section

continue in switch and loops, basic operators, logical operators, logical vs bitwise operators, logical and bitwise or, bit shifting, obtain bit mask, reverse bits, swap bits,

# C Programming Language (Prentice Hall Software)
# Let Us C Paperback - 2006 by Yashavant Kanetkar
# Understanding and Using C Pointers Core techniques for memory management
# Data Structures Using C and C++ Paperback - 1998
# Data Structures In C Paperback - August 11, 2008 by Noel Kalicharan