Appendix B. The basics of C
Throughout this book we’ve assumed you understand the basic syntax of Objective-C. Even if the iPhone is your first exposure to Objective-C, you may have preexisting knowledge of another language that shares a similar lineage with the C language. As an example, the basic control structures in C, C++, Java, and C# are all essentially the same.
A lot of beginner Objective-C developers don’t fully appreciate the C linage of Objective-C, but Objective-C is essentially a layer over top of C. Every valid C program is also, by definition, a valid Objective-C program, albeit one that doesn’t take advantage of Objective-C’s object-oriented features.
The impact of this lineage is that most of the syntax in Objective-C for making decisions and controlling the flow of execution throughout an application is virtually identical to that of the C programming language. If you want to become a truly great Objective-C programmer, you must first become an ace at using C.
If you are new to programming or haven’t written code in a C-inspired language before, this appendix is for you: it covers the basic control structures and details of programming in a C-style language. Let’s begin our discussion by looking at how variables, messages, and classes should be named to avoid potential errors during compilation.