Answers for "how to use or operator in c"

C
2

C logical operators

1. && (AND) is true when both the conditions are true

    “1 and 0” is evaluated as false

    “0 and 0” is evaluated as false

    “1 and 1” is evaluated as true

2. || (OR) is true when at least one of the conditions is true. (1 or 0 = 1)(1 or 1 = 1)

3. ! returns true if given false and false if given true.

    !(3==3) evaluates to false

    !(3>30) evaluates to true
Posted by: Guest on August-21-2021
0

c |= operator

// | is the binary "or" operator
// a |= b is equivalent to a = a|b

#include <stdio.h>

int main() {
   int a = 10;  // 00001010 in binary
   int b = 6;   // 00000110 in binary

   printf("Result : %dn", a |= b);
   // Result is 14 which is OOOO111O in binary

   return 0;
}
Posted by: Guest on September-08-2021

Code answers related to "C"

Browse Popular Code Answers by Language