Beebug


The C Programming Language

Author: Ray Hughes
Publisher: Prentice-Hall
Machine: Spectrum 16K/48K/BBC A/BBC B/Electron

 
Published in Beebug #59

This month we commence a short series on programming in the language 'C'. Anyone who wishes to pursue C more seriously will need an adequate reference, and the book most often recommended is 'The C Programming Language' by B. W. Kernighan and D. M. Ritchie. Ray Hughes gives a run down of what you can expect to find in this acclaimed book.

The C Programming Language (Prentice Hall)

The C Programming Language is an excellent introduction to the world of C programming, containing 228 pages of highly readable information laid out in several distinct sections.

A Tutorial

This is included to enable programmers new to C to pick up the language as quickly as possible. However, as the book says, it is not a beginner's guide to programming, and its readers are expected to understand already such concepts as variables, assignments, loops and functions etc. It gets into coding straight away with a good old "Hello world" type program, which is probably the first piece of code written in any language by first time users. Throughout the book, there are also question and answer sessions to allow the reader to full1 check that he/she understands the current chapter before moving on to the next. The tutorial in its 30 odd pages manages to cover the main core of the language.

Language And Program Structure

This section of the book deals with the more complex ideas that need to be covered for a full understanding of the facilities that can be made available to the C programmer. This is in fact the main body of the book and covers in order the following topics:

Types, Operations and Expressions
(Char, int, float, short, long, double etc)

Control Flow
(While, wend, for, next, do-while, case, etc)

Functions and Program Structure
(main() recursion, macros etc)

Pointers and Arrays
(pointers, multi-dimensional arrays etc)

Structures
(lookup tables, fields, Unions etc)

Input/Output
(getchar, putchar, scanf, file access etc)

This then ends the main body of the book. However, the last 85 pages cover other aspects of the language that serious users will want to know about. There is a special chapter on the UNIX system interface, but this may not be of much use to Acorn machine owners, except those lucky Archie owners who may one day get access to UNIX via the proposed ARX operating system.

Next there is the C reference manual which is a full and concise description of all keywords etc, with brief examples of their use. Finally, we have an excellent index covering all items mentioned in the preceding pages.

Throughout the book the authors describe and recommend standard programming techniques, and extensive use is made of examples to demonstrate, in particular, structured programming methods. Many short, and some not so short programs are listed in the book, many of which I am sure budding programmers will take and later modify to their Own requirements.

Conclusion

Although reviewed many times since it was first published in 1978, this may be the first review of K&R read by many Beebug readers, since C has only recently been released for the Acorn machines. Now nearly a decade old, this book has remained throughout that time the most important reference work for C programmers. It has no equal in what it attempts to achieve; or the deceptive ease with which this is accomplished.

Both the Acorn and Beebug implementations of C refer the reader to Kernighan & Ritchie for a detailed guide to the C language. It is certainly not a cheap book (although Beebug members are entitled to the usual discount), and compared to some language manuals seems quite thin at 228 pages. However, the information contained within those page is excellent, and the book really should be considered an absolute must by any prospective C programmer who wants to exploit the language fully.

Ray Hughes