C Programming/What you need before you can learn

History C Programming
What you need before you can learn
Obtaining a compiler

Getting StartedEdit

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 NeedEdit

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 NeedEdit

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.

CompilersEdit

A compiler is a sophisticated piece of software for converting the C source code you write with your text editor into the machine code[1] 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:

Name Website Platform License Details
Microsoft Visual Studio Community Visual Studio Windows Proprietary, free of charge Powerful and student-friendly version of an industry standard compiler.
Xcode Xcode macOS, OSX Proprietary, free of charge Available free of charge at Mac App Store.
Tiny C Compiler (TCC) tinycc GNU/Linux, Windows LGPL Small, fast and simple compiler.
Clang clang GNU/Linux, Windows, Unix, OS X University of Illinois/NCSA License A free, permissively licensed front-end using a LLVM backend.
GNU C Compiler gcc GNU/Linux, MinGW or mingw-w64 (Windows), Unix, OS X. GPL The De facto standard. Ships with most Unix systems.
Text Editors and IDEsEdit

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 Atom, 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:

Name Website Platform License Details
Eclipse CDT Eclipse Windows, Mac OS X, GNU/Linux Free/Libre and Open Source Eclipse IDE for C/C++ developement, a popular open source IDE.
Netbeans Netbeans Cross-platform CDDL and GPL 2.0 A Good comparable matured IDE to Eclipse.
GNOME Builder Builder GNU/Linux GPL A feature-rich but simple IDE for the GNOME desktop environment.
Anjuta Anjuta GNU/Linux GPL An extensible GTK+3 IDE for the GNOME desktop environment.
Geany geany Cross-platform GPL A lightweight cross-platform GTK+ notepad based on Scintilla, with basic IDE features.
KDevelop KDevelop Cross-platform GPL A cross-platform IDE for the KDE project.
Little C Compiler (LCC) lcc Windows Open Source but not Libre Small open source compiler.
Pelles C Pelles C Windows, Pocket PC Proprietary, free of charge A complete C development kit for Windows.
Dev-C++ Dev C++ Windows GPL Updated version of the formerly popular Bloodshed Dev-C++.
CodeLite CodeLite Cross-platform GPL 2 Free IDE for C/C++ development.
Code::Blocks Code::Blocks Cross-platform GPL 3.0 Built to meet users' most demanding needs. Very extensible and fully configurable.

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.[2] 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.

FootnotesEdit

  1. Actually, GCC’s (GNU C Compiler) cc (C Compiler) translates the input .c file to the target CPU’s assembly, output is written to an .s file. Then as (assembler) generates a machine code file from the .s file. Pre-processing is done by another sub-program cpp (C PreProcessor), which is not to be confused with c++ (a compiler for another programming language).
  2. http://orwelldevcpp.blogspot.com/
  History C Programming
What you need before you can learn
Obtaining a compiler