Learn C on the Mac

Book description

Considered a classic by an entire generation of Mac programmers, this popular guide has been updated for Mac OS X. Don't know anything about programming? No problem! Acclaimed author Dave Mark starts out with the basics and takes you through a complete course in programming C using Apple's free Xcode tools. This book is perfect for beginners learning to program. It includes Mac OS X examples!

  • Provides best practices for programming newbies

  • Written by the expert on C–programming for the Mac

  • Presents all the basics with a pragmatic, Mac OS X-flavored approach

  • Includes updated source code which is fully compatible with Xcode 4

What you'll learn

  • Master C programming, the gateway to programming your Mac or iPhone

  • Write applications for the Mac OS X interface, the cleanest user interface around

  • Understand variables and how to design your own data structures

  • Work with the file system

  • Connect to data sources and the Internet

Who this book is for

For anyone wanting to learn to program in Mac OS X, including developers new to the Mac, developers new to C, or students entirely new to programming. For anyone who wants to learn how to program their iPhone, this is also the core language primer.

Table of contents

  1. Title Page
  2. Dedication
  3. Contents at a Glance
  4. Contents
  5. About the Author
  6. About the Technical Reviewer
  7. Acknowledgments
  8. Preface
  9. Chapter 1: Welcome Aboard
    1. Who Is This Book For?
    2. The Lay of the Land
  10. Chapter 2: Go Get the Tools!
    1. Create an ADC Account
    2. Download the Tools
    3. Installing the Tools
    4. Take Your Tools for a Test Drive
    5. Downloading the Book Projects
    6. Let's Move On
  11. Chapter 3: Programming Basics
    1. Programming
    2. The Programming Process
    3. What's Next?
  12. Chapter 4: C Basics: Functions
    1. C Functions
    2. Calling a Function
    3. A Brief History of C
    4. The Standard Library
    5. Exploring Unix and Your Mac's Built-In Manual
    6. Same Program, Two Functions
    7. Let's Do That Again, Again, Again
    8. Generating Some Errors
    9. C Is Case Sensitive
    10. What's Next?
  13. Chapter 5: C Basics: Variables and Operators
    1. An Introduction to Variables
    2. Operators
    3. Using Parentheses
    4. Operator Precedence
    5. Sample Programs
    6. Sprucing Up Your Code
    7. What's Next?
  14. Chapter 6: Controlling Your Program's Flow
    1. Flow Control
    2. Expressions
    3. What's Next?
  15. Chapter 7: Pointers and Parameters
    1. What Is a Pointer?
    2. Pointer Basics
    3. Function Parameters
    4. What Does All This Have to Do with Pointers?
    5. Global Variables and Function Returns
    6. More Sample Programs
    7. Using the Debugger
    8. What's Next?
  16. Chapter 8: Variable Data Types
    1. Data Types Beyond int
    2. Working with Characters
    3. Arrays
    4. Danger, Will Robinson!
    5. Text Strings
    6. The #define Directive
    7. What's Next?
  17. Chapter 9: Designing Your Own Data Structures
    1. Bundling Your Data
    2. Model A: Three Arrays
    3. Finishing Up With Model A
    4. Model B: The Data Structure Approach
    5. Passing a struct As a Parameter
    6. Allocating Your Own Memory
    7. Working with Linked Lists
    8. What's Next?
  18. Chapter 10: Working with Files
    1. What Is a File?
    2. Working with Files: File Basics
    3. Working with Files: Writing Files
    4. Working with Files: Fancier File Manipulation
    5. What's Next?
  19. Chapter 11: Advanced Topics
    1. Typecasting
    2. Unions
    3. Function Recursion
    4. Binary Trees
    5. Function Pointers
    6. Initializers
    7. The Remaining Operators
    8. Creating Your Own Types
    9. Static Variables
    10. More on Strings
    11. What's Next?
  20. Chapter 12: Where Do You Go from Here?
    1. The Mac User Interface
    2. One Last Bit of Code
    3. Go Get 'Em
  21. Appendix: Answers to Exercises
    1. Chapter 4
    2. Chapter 5
    3. Chapter 6
    4. Chapter 7
    5. Chapter 8
    6. Chapter 9
    7. Chapter 10
    8. Chapter 11
  22. Index

Product information

  • Title: Learn C on the Mac
  • Author(s):
  • Release date: December 2008
  • Publisher(s): Apress
  • ISBN: 9781430218098