Execution of a piece of code in embedded
The code is tagged as ATMega328, so I assume you are coming from an Arduino plaform.
For an AVR, pins are controlled by hardware registers, each of which controls a bank of up to eight pins, known as a &quot;port&quot;. For example you will find the pins are labelled as for example: PA0 (Port A, bit 0), PB3 (Port B, bit 3) and so on.
Each bank of eight pins are controlled by hardware registers. In the case of the ATMega328p, there are three registers for each port. These are:

&quot;Direction register&quot; (DDRx) - controls whether a pin is an input (0) or an output (1).
&quot;Output register&quot; (PORTx) - sets whether an output drives low (0) or high (1)
&quot;Input register&quot; (PINx) - reads the current state of all pins in the bank, both inputs and outputs.

DDRB is the direction register for port B. Setting it equal to zero will set all eight pins on that port to be inputs.
PINB is the digital input register for port B. Reading its value will tell you the state of all eight pins on the port.
(x &amp; (1 &lt;&lt; 4)) &gt;&gt; 4; extracts bit 4 in a value using bit masking followed by bit shifts. In your case x is replaced by PINB, so you are in effect reading wether Port B, bit 4 (PB4) is high (1) or low (0).