You can program without a Operating System (OS), but the OS does the heavy lifting for you. For example with C (which you want to know) the magic it's not the language itself, but the compiler. Which basically what it does is something like this:
C source code -> Non-optimized
intermediate code -> Optimize
intermediate code -> Machine code
Now, the Machine code goes to the OS, which itself uses it's own Kernel for translating that Machine code, into binary form so the Hardware itself can understand what you want to do.
So basically before you write a program that runs without OS, you need to create your own compiler and a kernel for your machine to run it.