C environment settings
Local environment settings
If you want to set up the C language environment, you need to ensure that the following two software are available on your computer, a text editor and a C compiler.
Text Editor
This will be used to enter your program. Text editors include Windows Notepad, OS Edit command, Brief, Epsilon, EMACS, and vim/vi.
The name and version of the text editor may vary on different operating systems. For example, Notepad is commonly used on Windows operating systems, and vim/vi is available on Windows and Linux/UNIX operating systems.
Files created through an editor are often called source files, which contain program source code. Source files for C programs usually have the extension ".c".
Before you start programming, make sure you have a text editor and are experienced enough to write a computer program, then save it in a file, compile and execute it.
C Compiler
Source code written in source files is human-readable source. It needs to be "compiled" into machine language so that the CPU can execute the program according to the given instructions.
C language compiler is used to compile source code into the final executable program. It is assumed here that you already have a basic understanding of programming language compilers.
The most commonly used freely available compiler is GNU's C/C++ compiler, and if you are using HP or Solaris, you can use the compiler on the respective operating system.
The following sections will guide you on how to install the GNU C/C++ compiler on different operating systems. C/C++ is also mentioned here, mainly because GNU's gcc compiler is suitable for the C and C++ programming languages.
Installation on UNIX/Linux
If you are using Linux or UNIX, please use the following command on the command line to check whether it is installed on your system GCC:
$ gcc -v
If the GNU compiler is already installed on your computer, the following message will be displayed:
Using built-in specs.Target: i386-redhat-linuxConfigured with: ../configure --prefix=/usr .......Thread model: posix gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)
If GCC is not installed, please follow http://gcc.gnu. Detailed instructions at org/install/ install GCC.
This tutorial is written based on Linux, and all given examples have been compiled on Cent OS Linux systems.
Installation on Mac OS
If you are using Mac OS X, the fastest way to obtain GCC is to download the Xcode development environment from Apple's website and install it according to the installation instructions . Once Xcode is installed, you can use the GNU compiler.
Xcode is currently available for download at developer.apple.com/technologies/tools/.
Installation on Windows
In order to install GCC on Windows, you need to install MinGW. In order to install MinGW, please visit the MinGW homepage www.mingw.org, enter the MinGW download page, and download the latest version of the MinGW installer. The naming format is MinGW-<version>.exe.
When installing MinWG, you will need to install at least gcc-core, gcc-g++, binutils, and the MinGW runtime, but usually more will be installed.
Add the bin subdirectory of your MinGW installation to your PATH environment variable so that you can specify these tools by simple names on the command line.
When the installation is complete, you can run gcc, g++, ar, ranlib, dlltool, and some other GNU tools from the Windows command line.