Hello World in C, Dev Setup

As mentioned, I’m learning C, and I’ve achieved hello-world, plus recursive calculations of factorials and some data structures. Whee. :) For those playing along at home, I’ll describe my dev setup.

But first, an unexpected discovery: Counter to my intuition, there’s a beneficial synergy between learning a new editor and learning a new language at the same time. I had thought it would be too many new things to take on at once. I’ve wanted to learn Vim for its beautiful efficiency, but its formidable learning curve repels all comers. I couldn’t gain traction. When writing in a language with which I am comfortable (C#, English), my thoughts would run too fast, too far ahead of my rudimentary editor skills, ideas slipping out of my grasp as I stumbled around the text with j, k, h, and l (and never the one I meant). But in C, where I am carefully picking my way over unfamiliar terrain, my lines of code have slowed down to match my fingers. Because I am trying to hang onto only one edit at a time, I can spare a second to check that A will switch me to insert mode at the end of the current line. I recommend it: learning a new language is a good time to learn a new text editor.


I use VirtualBox to run virtual machines. VMs are excellent for experiment-based learning; think of it: a nice clean server that you can start up, poke and abuse, throw away and start again. If you start with the right VM image—for example, one configured for Ruby on Rails—you can jump right into the experimentation without all the installation hoop-jumping.

For this endeavor I chose TurnKey Linux’s Core appliance because it’s just Linux and not much else, following their instructions for installing a TurnKey appliance.

To install a compiler (later), I needed my VM to connect to the internet. In VirtualBox Settings > Network, I set “Attached to” to “Bridged Adapter,” meaning the VM could use my laptop’s connection, and the adapter’s “Name” to my wireless card. (The other choice in the dropdown list is a PCI-E Fast Ethernet Controller, and that… didn’t work.) With that set, I powered up the VM, which starts the webmin console. I let it automatically configure DHCP, and I was internet-ready.


Vim is already installed on the Core VM image, so I just needed to type “vim helloworld.c” to start stumbling around my new code file. I’m relying on the TuXfiles Vim cheat sheet.


I chose GCC, the GNU Compiler Collection for my C compiler, and I needed to download and install it. Following TurnKey’s apt-get instructions:

  • apt-get update (to update apt’s list of modules)
  • apt-cache search gcc (to find modules for the gcc compiler – gcc-4.1 looked right.)
  • apt-cache show gcc-4.1 (to get info about it)
  • apt-get install gcc-4.1 (to install it)
  • gcc-4.1 myfile.c -o myexename (to compile and generate myexename executable)
  • ./myexename (to run my program)

Hello World

I followed a video that creates and compiles a C program using the GCC compiler. “Hello, World!” A simple phrase, profoundly satisfying.

About Sharon Cichelli

I am a Principal Technical Lead at Headspring, developing enterprise-changing software and coaching teams to deliver value without death marches. I am a .NET developer, open-source contributor, user group organizer, technical blogger, pinball fan, and Arduino enthusiast.
This entry was posted in C. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • Gareth

    Cool. I’ve been learning it too.

    I recommend this course, or the first half of it anyway which covers C. You can download videos of all the lectures and get access to all the course material:


  • I had never heard of the Turnkey Linux stuff. That is awesome. I’m looking forward to the rest of your posts Sharon. Thank you for sharing this experience.

  • Another really good cheat sheet is on the viemu site:

    Also, if you can spare the $100, once you learn Vim you can buy Viemu and use it in Visual Studio and code your C# stuff. :) It is what I’m doing to stay sharp.

  • Gareth, ooh, thanks for the link to the course materials. You mention that you’re learning C, too; are you blogging about it?

    Jason, I had a feeling there was a better cheat sheet out there; thanks!