Directives

Variables

Conditionals

Loops

Arrays

Pointers

Strings

Functions


Site Map

Learn How to Program in C

by Dr. Kristin Switala


Introduction

This tutorial is designed for people with little or no computer programming knowledge. It only requires a basic understanding of either Windows or Unix. 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 topic in this tutorial has three parts: a lesson, review questions/exercises, and projects. You can either go through it step by step, by clicking on the links at the bottom of each page. Or, if you want to go directly to a particular topic, visit the Site Map.


About C

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.


What does a C compiler do?

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.


Where can I get a C compiler?

Because C is a compiled language, you must install a compiler on your computer before running any C programs. There are many excellent compilers, including freeware and shareware available on the Internet.

For a list of free C compilers, which you can download from the Internet, go to www.google.com and type "C compiler" in the search box. Google provides the latest list of C compilers available.

Copyright
© 2001
Kristin Switala

Next Lesson

Hosted by www.Geocities.ws

1