Writing C Program outside of Arduino IDE?

You're absolutely right about needing to link against other libraries. However, you don't necessarily need to worry about all of the details yourself, unless you want/need to do something unusual. Several alternative IDEs already support Arduino, typically via plugins which handle a lot of the details automatically.

I normally recommend Eclipse as it's a very widely used IDE for various purposes. However, there are several other possibilities. See this question for more information:

  • What are the other IDEs for Arduino?

Here you are two nice articles how Arduino actually works in background. How it removed friction from microcontroller programming.

  1. A Tour of the Arduino Internals: How does Hello World actually work?
  2. Arduino and GCC, compiling and uploading programs using only makefiles

It was also discussed here Is there a way or tutorial for converting Arduino code to C code?