View on GitHub

Sistemas-Embarcados

Sistemas Embarcados e IoT

Operadores Bit-a-Bit

Prof. Eduardo Ono

 

Operadores &, | e ~

int a = 0b00001011; // 11 (base 10)
int b = 0b00000110; // 6 (base 10)
int c = a & b; // 0b00000010 = 2 (base 10)
int d = a | b; // 0b00001111 = 15 (base 10)
int e = ~a; // 0b11110100 

 

Operadores « e »

int a = 0b000000001; // 1 (base 10)
int b = a << 1; // 0b00000010 // 2 (base 10)
int c = a << 3; // 0b00001000 // 8 (base 10)

 

Vídeos de Apoio

Thumb Descrição Tópicos Abordados
img [Professor Rafael Ivo]
Programação em C - 05 - Operadores Bit a Bit
(17:22, YouTube, Abr/2020)
<li>Operadores &, |, ~, « e ».</li>
img [Bobsien]
DICAS12 - Entendendo o Bitwise, AND e OR lógica para uso em microcontroladores!
(10:34, YouTube, Mar/2020)