Using Raspbian and after installing the BCM2835 libraries, any code can be created using vim:
If you are not familiar with vim editor
check this, and you can always use any editor you like.
After editing your code you need to
compile it:gcc -o example -l rt example.c -l bcm2835
Final step is to execute it