C Programming/What you need before you can learn

Getting Started
This book introduces and teaches the basics of the C programming language and touches upon some advanced topics as well. This section outlines the required skills and tools you'll need to get the most out of this book.

Skills and Prior Experience You'll Need
This book is for beginning programmers, so don't worry if you have no formal computer training or prior programming experience. It's assumed you know how to turn your computer on, start and stop applications, and perform other basic operations like installing software. It's also assumed you have some experience interacting with your operating system through a terminal window using its command line interface. If you aren't sure what this means, consider seeking out a tutorial for your chosen platform that can get you comfortable with getting around your computer's command line. At a minimum, you should know the basic commands for navigating to different directories and performing simple file management operations. This book will spell out any other commands you'll need to run from the command line to get your C code working on your machine.

Software You'll Need
No one ever became a musician just by reading sheet music. Musicians have to constantly play and practice on their instruments to get good. Similarly, the only way to become a programmer is to write and execute lots of code. To do that, you will need two different pieces of software: a compiler and a text editor. Both can be had for no cost.

Compilers
A compiler is a sophisticated piece of software for converting the C source code you write with your text editor into the machine code that you can execute on your computer. Below is a list of some popular C compilers. Note that some of the compilers listed below come as part of an integrated development environment (IDE). However, if you are brand new to programming, it's best if you can install and run the compiler from the command line instead of through an IDE. This book uses the GNU C Compiler (GCC) in its examples so we recommend installing this compiler for use with this book. The next section in this chapter will explain how to download and install the GCC software to your machine.

Popular C compilers/IDEs include:

Text Editors and IDEs
Aside from a compiler, the only other software requirement is a text editor for writing and saving your C code. Note that a text editor is different from a word processor, a piece of software with many features for creating visually appealing documents. Unlike word processors, text editors are primarily designed to create plain text files. On Windows, the Notepad text editor can be used but it does not offer any advanced capabilities such as syntax highlighting and code completion. There are hundreds of text editors (see List of Text Editors). Among the most popular are Notepad++ for Windows as well as Sublime Text, gedit, Vim and Emacs which are also available on other operating systems (“cross-platform”). These text editors come with syntax highlighting and line numbers, which makes code easier to read at a glance, and to spot syntax errors. Many text editors have features for increasing your coding speed, such as keystroke macros and code snippets, that you can take advantage of as you gain skill as a programmer.

You may also be considering the use of an integrated Development Environment (IDE) to help you write code. An IDE is a suite of integrated tools and features in one convenient package, usually with a graphical user interface. These programs include a text editor and file browser and are also sometimes bundled with an easily accessible compiler. They also typically include a debugger, a tool that will enable you to do such things as step through the program you develop manually one source code line at a time, or alter data as an aid to finding and correcting programming errors.

However, many IDEs do not offer a command line interface to the compiler and/or offer only graphical buttons or a menu for executing programs. So for new programmers, an IDE is not ideal. Instead, a simple text editor will suffice along with the ability to issue simple commands on the command line to help you gain a hands-on familiarity and understanding of core development tools. Of course, an IDE may still be useful to you if you have experience with one. But as a general guideline: Do not use an IDE unless you know what the IDE is doing for you!

Other popular compilers/IDEs include:

On GNU/Linux, GCC is almost always included by default.

On Microsoft Windows, Dev-C++ is recommended for beginners because it is easy to use, free, and simple to install. Although the initial developer (Bloodshed) hasn’t updated it since 2005, a new version appeared in 2011, made by an independent programmer, and is being actively developed. An alternate option for those working only in the Windows environment is the proprietary Microsoft Visual Studio Community which is free of charge and has an excellent debugger.

On Mac OS X, the Xcode IDE provides the compilers needed to compile various source files. The newer versions do not include the command line tools. They need to be downloaded via Xcode->Preferences->Downloads.