The PORTx register functions differently depending on whether a pin is set to input or output. The simpler case is if a pin is set to output. Then, the PORTC register, for example, controls the value at the physical IO pins on Port C. For example, we can set all the port C pins to output and then make 4 of them high (binary 1) and 4 of them low (binary 0):
outb(DDRC, 0xFF); //Set all Port C pins to output
outb(PORTC, 0xF0); //Set first 4 pins of Port C low and next 4 pins high
When a pin is set to be an input, PORTx register DOES NOT contain the logic values applied to the pins. We use the PINx register for that. If a pin is an input, a 1 in the PORTx register sets a pull-up resistor. This is helpful for a variety of circuits. An equivalent schematic of the pull-up resistor is given below.
outb(DDRC, 0x00); //Set all Port C pins to input
outb(PORTC, 0xFF); //Set pull-up resistors on Port C