Before you start writing in C, you will need some C programming software. Let's see exactly what you need!
Before you can write a program, you need an editor and a compiler.
The editor is a program where you write the source code of your program. You want to use a smart editor that helps with coding. Such editors will use different colors for keywords, values and variables. It is also desired that it will help with code suggestions.
Note: The editor is not a compiler!
There are hundreds of free editor programs. Before you go to download any of them, keep reading.
A compiler is a program that translates the source code from programming language to a machine language. There are several good C compilers out there and we will talk about them a little later.
There are programs that contain in one place both a good editor to write your code and the compiler to translate that code to machine language. These more complex programs are called Integrated Development Environment (IDE). Most of them also provide a convenient way to debug your programs.
If you are just starting with programming – start with an IDE. Right now, you need to focus on the language and programming principles. Later you can transition to another environment, if you need to.
My advice for the beginners is to choose one of the IDEs that come with a compiler and skip to the end of the page and continue with the "Hello world" lesson. Installing an external compiler on Windows takes more reading and effort than a beginner wants to invest right now.
In Linux it is easier and this is good, because the popular environments come without an integrated compiler.
If you are using Windows, probably the easiest way to go is Visual Studio. It is free, easy to install and once you install it, you are ready to go. Mirosoft's VS integrates a good editor, compiler and a very useful debugger. It uses its own compiler, so you don't need to install one manually.
The downside is, that VS does not care much about the recent C standards. It complies to ANSI C. Starting with MSVS 2013, it supports big part of C99. Microsoft also added their set of keywords and functions to the implementation.
Visual Studio is more than capable to carry you through this tutorial. If later you decide that you need to use the features of C11 you can switch to another IDE.
You can get it from: https://www.visualstudio.com/. It may require a free registration of the installation.
This is also a great choice for a C programming software. Code::Blocks is available for different platforms. It is open source, fast, has a clean look and a useful debugger.
Code::Blocks supports a number of compilers and it also has a distribution that includes the TDM-GCC compiler. Get it from: http://www.codeblocks.org/downloads/26
Dev-Cpp is another IDE that is easy to get started with. You can get a distribution with or without an integrated compiler. I recommend the distribution with the TDM-GCC 4.9.2 32/64bit. Just download it, install and you can target both 32 and 64 bit machines.
Get it from: http://sourceforge.net/projects/orwelldevcpp/.
This is my current environment for C development under Linux. It is lightweight and easy to work on.
Geany does not have its own compiler, so you need to install an external compiler, like the GNU GCC. While installing GCC in Windows needs some time and reading, it is rather easy in Linux, so this should not be a problem.
To install it, type (as root): apt-get install geany
This is just a short list of some of the popular C compilers. There are many more, but it is out of our scope to list them all.
Now that you have your C programming software installed, it is time to create your first application. By tradition, in the next lesson you will create a "Hello, world!" application and later learn about the structure of a C program.
Previous: Overview of the C programming tutorial |
Next lesson: Hello, world! |