|
performs a bitwise OR on the two operands it is passed.
For example,
byte b = 0x0A | 0x50;
If you look at the underlying bits for 0x0A
and 0x50
, they are 0b00001010
and 0b01010000
respectively. When combined with the OR operator the result in b
is 0b01011010
, or 0x5A
in hexadecimal.
|=
is analogous to operators like +=
and -=
in that it will perform a bitwise OR on the two operands then store the result in the left operator.
byte b = 0x0A; b |= 0x50; // after this b = 0x5A
Related Posts:
- What is Bit Masking?
- Arduino Sketch upload issue – avrdude: stk500_recv(): programmer is not responding
- Arduino Sketch upload issue – avrdude: stk500_recv(): programmer is not responding
- avrdude: stk500v2_ReceiveMessage(): timeout
- How to convert int to string on Arduino?
- avrdude: ser_open(): can’t open device “\\.\COM3”: Access is denied
- Arduino Nano – “avrdude: ser_open():system can’t open device “\\.\COM1″: the system cannot find the file specified”
- When a number is written as 0x00… what does the x mean
- What are 0x01 and 0x80 representative of in C bitwise operations?
- arduino suddenly shows “avrdude: ser_open(): can’t open device “\\.\COM3” after last upload
- Mapping a numeric range onto another
- Are the shift operators (<<, >>) arithmetic or logical in C?
- ATMega328P “AVRDude: Could not find USBTiny Device (0x1781/0xc9f)”
- try/catch block in Arduino
- how to stop a loop arduino
- The difference between logical shift right, arithmetic shift right, and rotate right
- What is “2’s Complement”?
- The difference between n++ and ++n at the end of a while loop? (ANSI C)
- How many spaces for tab character(\t)?
- Working on code to calculate cosine with factorial sum
- warning: implicit declaration of function
- What is the effect of extern “C” in C++?
- What exactly is the difference between “pass by reference” in C and in C++?
- What does “collect2: error: ld returned 1 exit status” mean?
- How to convert a string to integer in C?
- What is the behavior of integer division?
- max value of integer
- What are bitwise shift (bit-shift) operators and how do they work?
- Convert an int to ASCII character
- Awesomium sdk download
- Bad File Descriptor with Linux Socket write() Bad File Descriptor C
- What is the difference between char s[] and char *s?
- Error “initializer element is not constant” when trying to initialize variable with const
- need help understanding the movzbl call in this function
- How to extract C source code from .so file?
- What is the difference between read and pread in unix?
- What does “control reaches end of non-void function” mean?
- connect Error: “No route to host”
- C error: undefined reference to function, but it IS defined
- What is the printf format specifier for bool?
- warning: implicit declaration of function
- C dynamically growing array
- How to printf “unsigned long” in C?
- Why do I get an assertion failure?
- C language: float % float why expression must have integral type
- Reading \r (carriage return) vs \n (newline) from console with getc?
- How to convert integer to string in C?
- Invalid pointer error on invoking free() after malloc in C
- In C, how should I read a text file and print all strings
- What does “Size in TCHARs” means?
- return makes integer from pointer without a cast [-Wint-conversion] return candidate
- Math constant PI value in C
- How to convert C++ Code to C
- Eclipse C++ : “Program “g++” not found in PATH”
- How can I use an array of function pointers?
- When and why to use malloc?
- C compile error: Id returned 1 exit status
- How do I concatenate const/literal strings in C?
- Efficient way to find task_struct by pid
- Why am I getting this memory access error ‘double free or corruption’?
- size of struct in C
- Anyone know how to solve the error of “collect2.exe: error: ld returned 1 exit status” when a program in C is running?
- How to iterate over a string in C?
- Where is the C auto keyword used?
- “No such file or directory” error in CodeBlocks
- What is the C equivalent to the C++ cin statement?
- Why are hexadecimal numbers prefixed with 0x?
- Uninitialized value was created by a heap allocation
- Makefile:1: *** missing separator. Stop
- xorl %eax – Instruction set architecture in IA-32
- Assembly x86 – “leave” Instruction
- Excess elements of scalar initializer for pointer to array of ints
- How does one represent the empty char?
- Can I define a function inside a C structure?
- Trim a string in C [duplicate]
- Casting a pointer to an int
- How to repeat a char using printf?
- C Unknown type name ‘my_structure’
- Source file not compiled Dev C++
- PTHREAD_MUTEX_INITIALIZER vs pthread_mutex_init ( &mutex, param)
- How to concatenate string and int in C?
- execvp: bad address error
- How detect malloc failure?
- How to display hexadecimal numbers in C?
- A Simple, 2d cross-platform graphics library for c or c++?
- Removing last character in C
- Difference between char *argv[] and char **argv for the second argument to main()
- How do you format an unsigned long long int using printf?
- error : storage class specified for parameter
- Dereference void pointer
- “-bash: gcc: command not found” using cygwin when compiling c?
- What do \t and \b do?
- write() to stdout and printf output not interleaved?
- Difference between “while” loop and “do while” loop
- Swapping 2 Bytes of Integer
- GDB no such file or directory
- Level vs Edge Trigger Network Event Mechanisms
- How to convert integers to characters in C?
- variably modified array at file scope in C
- How to use random() in C [duplicate]