In order to program in C you need to have both a text editor and an ANSI-C compatible compiler/linker. Many are available on the Internet -- some are free while others have licensing requirements. In addition, a number of companies have created Integrated Development Environments (IDE) which combine the compiler and text editor into one package. An example of an IDE is Arduino which combines a text editor with the gcc compiler/linker for C language in one package.
As you you download and install the text editor and gcc compiler/linker, you may want to follow along with our instructional videoas our class goes step by step through the installation answering questions as we go.
We assume you are using a computer that uses Microsoft Windows as the operating system. If you are using Linux, the compiler and editor are already installed on your computer.
Text Editor
Why do I need it?
For writing programs you need a text editor. Windows includes a text editor with
the operating system called "Notepad". It is important to note that a text editor is not the same as a word processor (i.e. Microsoft Word). A word processor deals with the preparation of documents for printing. Besides editing text, a modern word processor allows the user to choose multiple fonts, margin sizes, line spacing, indentation, and a variety of other details that affect the appearance of the document being edited. (These additional details are encoded in characters that are not seen on the user screen.)
In a text editor, these features are absent. A text editor is an application that edits files containing plain text without information regarding formatting. Typically, the contents of such a file consist of data used by another application, for example, source code that a compiler will process or mark up text that a web browser will display. In place of word processing features, a text editor may contain features that allow the user to prepare and work with text quickly and efficiently, for example, displaying comments and ANSI-C key words in different colours. There are many free text editors available on the Internet.
What text editor should I use?
Microsoft windows has a built in text editor called Notepad which one could use to display only the text in the file. A better choice, for programming would be a text editor that recognizes sequences of characters that have significance in the computer language in which you are writing your program.
Notepad++ is an free editor (for Microsoft Windows) that has been designed to work with over 80 computer programming languages (including ANSI-C and Java, javascript). Once you have mastered it in ANSI-C, you will be able to use the same editor to prepare your programs,no matter in what language you decide to program: c, html, javascript, css. The following figure compares how the same C-code file is presented in notepad and in notepad++
Once you have written your program you need to use a compiler to translate your words into binary machine code that the computer can understand. In addition, you also need to link your functions with functions written by other people (There is no point to reinvent the wheel!). For example, if you are programming Arduino, then probably 99.9% of the code has been written by other people! You just need to incorporate their work into your program.
What compiler/linker should I use?
If you are using UNIX or LINUX then the Gnu Compiler Collection (gcc) is already installed on your computer -- you do not need to do anything. For windows users, I suggest MinGW port of gcc as it is one of the best supported free compilers. (Another port of gcc is the one used for Arduino, and it includes the text editor together with the compiler.)