ACCESSING PORTS

Or to define a set of macros:

#define setbits(var, bits) var |= (bits)
#define clrbits(var, bits) var &=~(bits)
#define flpbits(var, bits) var ^= (bits)

with that, you can operate on the port (or ddr or any other register for that matter)

setbits(PORTB, (1<<2)); //sets bit2 on portb
clrbits(DDRB, (1<<0)); //bit0 on portb set as input
flpbits(PORTB, (1<<2) | (1<<3)); //flip bit2 and bit3 on portb