The following series of tutorials are designed for people with little or no computer programming knowledge. They only require a basic understanding of either Windows or Unix and you must have a C compiler with an IDE, or you must understand how to use a plain text editor, such as vi (in Unix) or Notepad (in Windows).
Each tutorial in this series is listed below as they get written. You can always refer back here for the index, or follow along using the “continue to …” links located at the bottom of each post.
Before we jump into anything though it’s important to have a little bit of knowledge about C itself. In the early 1970s scientists at Bell Laboratories were struggling to produce a programming language to run on the new UNIX (1969) operating system. In 1971 Dennis Ritchie developed C, which has become one of the most popular and powerful programming languages. C is used to create software and a variety of other programs.
Like all programming languages, C must be compiled. A compiler is a program that translates human language (such as English) into machine language (binary code: 100100011…). When a program is compiled, it runs much faster and does not take up as much space in memory as a scripting language, which is stored in memory and is read line-by-line.
When you write a C program in a plain text editor, such as vi (Unix) or Notepad (Windows), you are creating a source code. This source code is saved in a file with the .c extension. This is called the source file.
After saving the source code, you must run it through the compiler, to translate the English instructions into binary code. This creates an object file, with the .o or .obj or .mix extension. If there are mistakes in your source code, the compiler will print error messages on the screen and refuse to compile your program. Simply go back into your source code and make the corrections, then run it through the compiler again.
Next, you must link the object code to the C libraries, which contain code modules for performing specific tasks. Once the libraries are linked to your object file, the computer creates an executable file with the .exe extension.
Finally you can run your C program.
Continue on to Directives and Functions.Read More »