Pls. refer the links below to control the GPIO using C :
Here, the approach is to control the gpio by mapping the registers using mmap. But, the ideal approach would be to write the gpio driver & control the gpios from the application using the device file. I am planning to write the one and will share it once it is done.