Setting Up Your Environment
To write programs you will need a development environment. This section will show you how to set one up.
To write a program you will need 2 things. A text editor and a compiler. That's it. You can choose to use an integrated development environment (IDE) if you like. However, to keep it simple for this book, we will be using just a compiler and a text editor.
C compilers exists on many different platforms. However, you may need to download the appropriate tool for your specific platform.
Text editor (code editor)
A text editor is a program that lets you type in text. Every operating system typically include some way of creating text. However, they may not suit your needs.
Note that word processors such as MS word are NOT text editors. The files that they produce not only contain the text that you type but also include formatting instructions. A text editor for coding should only store the text that you write. It is worth the time to investigate different text editors and find one that you like. It is the tool that you will use most so you need to be comfortable with it.
Below lists a few options for text editors. You can try out what works for you. These are not endorsements, just resources for you to consider
Application Name | Platform(s) | Comments |
---|---|---|
Notepad++ | Windows | Free as in speech and beer, a decent editor |
Sublime Text | Windows, Linux, OSX | free trial, a favorite of developers. license by user so it will cover you on multiple platforms |
Various command line editors (vi, emacs, nano) | linux, OSX | these are command line based text editors. No mouse or gui for them. vi is pretty much available for all unix based OS. Other two are usually available. Not the easiest to use if you aren't use to it, but good to learn. |
Compilers
Linux
On Linux, compilers are typically installed. To test if you have a compiler open up a console and type:
gcc
OSX
On OSX, you can get command line compilers for free. First you may need to get xcode from the app store. Once you have installed it, you should also have all the command line tools. Open up a terminal (Applications --> utility --> terminal) and type:
clang
If your tools are not installed it will install them.
Windows
On Windows, you should get and install visual studio. You can get visual studio express here: