Chapter 6. The C Language

C is probably the most successful programming language that there has ever been. Whether you realize it or not, most of the software you use daily has something to thank C for. Operating systems, such as Mac OS X, are invariably written in C, and most of the applications still with us from the days of Mac OS 9 and earlier rely on the Carbon framework, which is written in C (see Chapter 9). Popular languages, such as Java, also take much of their syntax from C. Let's face it, apart from the fact that it is still very much in use today, C is the Latin of computer languages.

C also forms the basis of Objective-C, which is a more modern variant used for most new application development on Mac OS X. Objective-C is the core language for the Cocoa frameworks, which you learn about in Chapter 8.

Half the battle of learning to program new applications on Mac OS X is learning to program in Objective-C, which you learn about in Chapter 7. And more than half of that battle is learning C. Objective-C is a superset of C, meaning it has everything that C has and a bit more. If you already know C, you are well on the way to mastering Objective-C and Cocoa development (Chapter 8).

In this chapter, you learn the basics of C, which will serve you well whether or not you continue to develop for Mac OS X. By the end, you should be able to read existing C code without too much trouble, and you will have the prerequisites for learning to write programs in Objective-C.

In this ...

Get Beginning Mac OS® X Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.