Change GPU clock frequency in program? Is there a way of making your C program manipulate the GPU&#3

Is there a way of writing a program that will manipulate the clock frequencies of the GPUs present in the system? Basically I want to write my own overclocking tool. How do I do this? I’d preferably do this in C btw.