5.1. Opening shots

5.1.1. So why is this important?

The arithmetic data types and operators of C are interesting but hardly rivetting. They show, collectively, a certain imagination and spirit that has stamped C with a special flavour, but they form the sauce, not the meat, of this particular dish. For most users, it's functions and the parts of the language covered in this chapter that provide the real feel of C.

For the new reader, this is the part of the language that causes the biggest problems. Most beginners with C are at least familiar with the use of arithmetic, functions and arrays; those are not the problem areas. The difficulties arise when we get on to the structured types (structures and unions), and the way that C just wouldn't be C without the use of pointers.

Pointers aren't a feature that you can choose to ignore. They're used everywhere; their influence affects the whole language and must be the single most noticeable feature of all but the simplest C programs. If you think that this is one of the bits you can skip because it's hard and doesn't look too important, you are wrong! Most of the examples used so far in this book have had pointers used in them (although not obviously), so you might as well accept the inevitable and learn how to use them properly.

The most natural way to introduce the use of pointers is by looking into arrays first. C intertwines arrays and pointers so closely that they are hard to separate. Since you are expected to be familiar with the use of arrays, their treatment will be brief and aimed at using them to illustrate the use of pointers when they are seen later.

5.1.2. Effect of the Standard

The new Standard has left very little mark on the contents of this chapter; a lot of it would be nearly word for word the same even if it only talked about Old C. The inference to be drawn is that nothing was wrong with the old version of the language, and that there was nothing to be gained by fixing what wasn't broken. This may be received with some relief by those readers who already knew this part of the old language and who, like the Committee, felt that it was good enough to leave alone.

Even so, the introduction of qualified types by the Standard does add some complexity to this chapter. The rules about exactly how the various arithmetic and relational operators work when they are applied to pointers have been clarified, which adds bulk to the text but has not changed things substantially. In the early examples we do not pay a lot of attention to them, but after that they are introduced gradually and where appropriate.