C Language Tutorial / PDF
C Language Tutorial / PDF
Sample of the pdf document :
Introduction
TheC programming language was originally developed by Dennis Ritchie of Bell Laboratories, and was designed to run on a PDP-11 with a UNIX operating system. Although it was originally intended to run under UNIX, there was a great interest in running it on the IBM PC and compatibles, and other systems. C is excellent for actually writing system level programs, and the entire Applix 1616/OS operating system is written in C (except for a few assembler routines).
It is an excellent language for this environment because of the simplicity of expression, the compactness of the code, and the wide range of applicability.
It is not a good "beginning" language because it is somewhat cryptic in nature.
It allows the programmer a wide range of operations from high level down to a very low level approaching
the level of assembly language. There seems to be no limit to the flexibility available. One
experienced C programmer made the statement, "You can program anything in C", and the
statement is well supported by my own experience with the language. Along with the resulting
freedom however, you take on a great deal of responsibility. It is very easy to write a program
that destroys itself due to the silly little errors that, say, a Pascal compiler will flag and call a
fatal error. In C, you are very much on your own, as you will soon find.
Since C is not a beginners language, I will assume you are not a beginning programmer, and I will not attempt to bore you by defining a constant and a variable. You will be expected to know these basic concepts. You will, however, not be expected to know anything of the C programming language. I will begin with the highest level of C programming, including the usually intimidating concepts of pointers, structures, and dynamic allocation.
To fully understand these concepts, it will take a good bit of time and work on your part, because they not particularly easy to grasp, but they are very powerful tools.
Enough said about that, you will see their power when we get there, just don’t allow yourself to worry about them yet.
Programming in C is a tremendous asset in those areas where you may want to use Assembly
Language, but would rather keep it a simple to write and easy to maintain program. It has been
said that a program written in C will pay a premium of a 50 to 100% increase in runtime, because
no language is as compact or fast as Assembly Language. However, the time saved in coding
can be tremendous, making it the most desirable language for many programming chores.
In addition, since most programs spend 90 percent of their operating time in only 10 percent or
less of the code, it is possible to write a program in C, then rewrite a small portion of the code
in Assembly Language and approach the execution speed of the same program if it were written
entirely in Assembly Language.
Approximately 75 percent of all new commercial programs introduced for the IBM PC have
been written in C, and the percentage is probably growing. Apple Macintosh system software
was formerly written in Pascal, but is now almost always written in C. The entire Applix 1616
operating system is written in C, with some assembler routines.
Since C was designed essentially by one person, and not by a committee, it is a very usable
language but not too closely defined. There was no official standard for the C language, but the
American National Standards Association (ANSI) has developed a standard for the language,
so it will follow rigid rules. It is interesting to note, however, that even though it did not have
a standard, the differences between implementations are usually small. This is probably due to
the fact that the original unofficial definition was so well thought out and carefully planned that
extensions to the language are not needed.
implementation to another, there are differences in compilers, as you will find any time you try
to use another compiler. Most of the differences become apparent when you use nonstandard
extensions such as calls to the MS-DOS BIOS, or the Applix 1616/OS system calls, but even
these differences can be minimized by careful choice of programming means.
Applix 1616 builders have only the HiTech C compiler available. This version of the tutorial is customised to suit HiTech C. The original MS-DOS version by Gordon Dodrill was ported to the Applix 1616 (with great effort) by Tim Ward, and typed up by Karen Ward.
The programs have been converted to HiTech C by Tim Ward and Mark Harvey, while Kathy Morton assisted greatly in getting Visual Calculator working. All have been tested on the Applix 1616/OS
multitasking operating system. The Applix distribution disks contain the complete original text of this tutorial, plus all the converted C source code. The second disk contains executable, relocatable versions of all the programs, ready to run on an Applix 1616. There is also a directory of the original IBM source code, for those using IBM computers, who may wish to try them with a different compiler. This printed version has been edited, indexed and pretty printed by Eric Lindsay, who added the Applix specific material.
This printed version of the tutorial includes copies of all the code, for easier reference. It also
includes a comprehensive table of contents, and index.
Click here for Download PDF / FREE
0 commentaires: