Friday, July 12, 2013

How To Program

 Table of Contents:

    1. A First Program
    2. Let's Compute
    3. Loops
    4. Symbolic Constants
    5. Conditionals
    6. Pointers
    7. Arrays
    8. Character Arrays
    9. I/O Capabilities
    10. Functions
    11. Command-line Arguments
    12. Graphical Interfaces: Dialog Boxes

This section contains a brief introduction to the C language. It is intended as a tutorial on the language, and aims at getting a reader new to C started as quickly as possible. It is certainly not intended as a substitute for any of the numerous textbooks on C.
The best way to learn a new ``human'' language is to speak it right from the outset, listening and repeating, leaving the intricacies of the grammar for later. The same applies to computer languages--to learn C, we must start writing C programs as quickly as possible.
An excellent textbook on C by two well-known and widely respected authors is:

 The C Programming Language -- ANSI C
 Brian W. C. Kernighan & Dennis M. Ritchie
 Prentice Hall, 1988

Dennis Ritchie designed and implemented the first C compiler on a PDP-11 (a prehistoric machine by today's standards, yet one which had enormous influence on modern scientific computation). The C language was based on two (now defunct) languages: BCPL, written by Martin Richards, and B, written by Ken Thompson in 1970 for the first UNIX system on a PDP-7. The original ``official'' C language was the ``K & R'' C, the nickname coming from the names of the two authors of the original ``The C Programming Language''. In 1988, the American National Standards Institute (ANSI) adopted a ``new and improved'' version of C, known today as ``ANSI C''. This is the version described in the current edition of ``The C Programming Language -- ANSI C''. The ANSI version contains many revisions to the syntax and the internal workings of the language, the major ones being improved calling syntax for procedures and standarization of most (but, unfortunately, not quite all!) system libraries.

1. A First Program
Let's be polite and start by saluting the world! Type the following program into your favorite