Setting GPIO pin as output pin

I am using nrf51822 DK. How to set GPIO pins as output pins and access the pins to set or reset the output.For example if I want to use pin 20 as output, how to configure that.I need the code syntax to do that. Can you please point out to any examples or code snippets if any? Can you also please tell me how to configure LEDs output on the board. There are four LEDs on the board. For example if I want to toggle 4th LED how to do that?