Considered a classic by an entire generation of Mac programmers, Dave Mark's Learn C on the Mac has been updated for you to include Mac OS X Mountain Lion and the latest iOS considerations. Learn C on the Mac: For OS X and iOS, Second Edition is perfect for beginners learning to program. It includes contemporary OS X and iOS examples! This book also does the following: • Provides best practices for programming newbies • Presents all the basics with a pragmatic, Mac OS X and iOS -flavored approach • Includes updated source code which is fully compatible with latest Xcode After reading this book, you'll be ready to program and build apps using the C language and Objective-C will become much easier for you to learn when you're ready to pick that up. .
Title Page; Copyright Page; Contents at a Glance; Table of Contents; About the Authors; About the Technical Reviewer; Acknowledgments; Introduction; Welcome Aboard; Who Is This Book For?; The Lay of the Land; Chapter 1 Go Get the Tools!; Installing Xcode; How much is that IDE in the Window?; What's a Registered Developer?; Getting the Projects; Using Xcode; Creating a New Xcode Project; The Workspace Window; Running a Project; Moving On; Chapter 2 Programming Basics; Programming; Some Alternatives to C; What About Objective-C, C#, C++, and Java? What's the Best Programming Language for the Mac or iOS Devices?The Programming Process; Source Code; Compiling Your Source Code; Building Your Application; What's Next?; Chapter 3 C Basics: Statements and Functions; C Statements; C Functions; Defining a Function; Syntax Errors and Algorithms; Calling a Function; Same Program, Two Functions; The Hello2 Project; The Hello2 Source Code; Running Hello2; Doing That Again, and Again, and Again; Generating Some Errors; Fixing the Problem; Getting Close; C is Case Sensitive; Exploring Xcode's Built-In Manuals; Getting Help Quickly; What's Next? Chapter 4 C Basics: Variables and OperatorsAn Introduction to Variables; Working with Variables; Variable Names; The Size of a Type; Bytes and Bits; Going from 1 Byte to 2 Bytes; Operators; The +, -, ++, and Operators; The += and -= Operators; The *, /, %, *=, /=, and %= Operators; Using Parentheses; Operator Precedence; Sample Programs; Opening Operator.xcodeproj; Stepping Through the Operator Source Code; Opening Postfix.xcode; Stepping Through the Postfix Source Code; Sprucing Up Your Code; Source Code Spacing; Comment Your Code; The Curly Brace Controversy; What's Next? Chapter 5 DebuggingWhat's a Debugger?; Controlling Execution; Setting Breakpoints; Stepping Over a Statement; Stepping Into a Function; Stepping Out of a Function; Full Speed Ahead; Examining Variables; How is a Debugger like an Iceberg?; What's Next?; Chapter 6 Controlling Your Program's Flow; Flow Control; The if Statement; Expressions; True Expressions; Comparative Operators; Logical Operators; The Not Operator; The And and Or Operators; TruthTester.xcodeproj; Compound Expressions; Statements; The Curly Braces; Where to Place the Semicolon; Two Common Pitfalls; The Loneliest Statement Unintentional AssignmentAvoiding Common Pitfalls; The while Statement; The for Statement; LoopTester.xcodeproj; The do Statement; The switch Statement; A case with No Statements; The Mixed Blessing of Fall-Through; switch Wrap-Up; Breaks in Loops; The continue Statement; IsOdd.xcodeproj; Stepping Through the IsOdd Source Code; NextPrime.xcodeproj; Stepping Through the NextPrime Source Code; What's Next?; Chapter 7 Pointers and Parameters; What Is a Pointer?; Why Use Pointers?; Checking Out of the Library; Pointer Basics; The Address of a Variable; The & Operator; Declaring a Pointer Variable The * Operator