Learn C on the Mac

von: David Mark

Apress, 2009

ISBN: 9781430218104 , 376 Seiten

Format: PDF, OL

Kopierschutz: Wasserzeichen

Windows PC,Mac OSX für alle DRM-fähigen eReader Apple iPad, Android Tablet PC's Online-Lesen für: Windows PC,Mac OSX,Linux

Preis: 35,30 EUR

Mehr zum Inhalt

Learn C on the Mac


 

Contents at a Glance

5

Contents

6

About the Author

13

About theTechnical Reviewer

14

Acknowledgments

15

Preface

16

Welcome Aboard

17

Who Is This Book For?

17

The Lay of the Land

18

Go Get the Tools!

20

Create an ADC Account

20

Download the Tools

21

Installing the Tools

23

Take Your Tools for a Test Drive

25

Downloading the Book Projects

31

Let’s Move On

31

Programming Basics

32

Programming

32

The Programming Process

35

What’s Next?

39

C Basics: Functions

40

C Functions

40

Calling a Function

44

A Brief History of C

47

The Standard Library

48

Exploring Unix and Your Mac’s Built-In Manual

49

Same Program, Two Functions

51

Let’s Do That Again, Again, Again

58

Generating Some Errors

59

C Is Case Sensitive

62

What’s Next?

62

C Basics: Variables and Operators

64

An Introduction to Variables

65

Operators

71

Using Parentheses

75

Operator Precedence

76

Sample Programs

78

Sprucing Up Your Code

92

What’s Next?

97

Controlling Your Program’s Flow

99

Flow Control

99

Expressions

102

What’s Next?

132

Pointers and Parameters

134

What Is a Pointer?

134

Pointer Basics

137

Function Parameters

144

What Does All This Have to Do with Pointers?

150

Global Variables and Function Returns

153

More Sample Programs

159

Using the Debugger

166

What’s Next?

170

Variable Data Types

173

Data Types Beyond int

173

Working with Characters

184

Arrays

190

Danger, Will Robinson!

196

Text Strings

197

The #define Directive

206

What’s Next?

215

Designing Your Own Data Structures

218

Bundling Your Data

218

Model A: Three Arrays

219

Finishing Up With Model A

231

Model B: The Data Structure Approach

233

Passing a struct As a Parameter

237

Allocating Your Own Memory

242

Working with Linked Lists

246

What’s Next?

258

Working with Files

260

What Is a File?

261

Working with Files: File Basics

261

Working with Files: Writing Files

270

Working with Files: Fancier File Manipulation

283

What’s Next?

292

Advanced Topics

294

Typecasting

294

Unions

298

Function Recursion

301

Binary Trees

305

Function Pointers

312

Initializers

313

The Remaining Operators

316

Creating Your Own Types

319

Static Variables

321

More on Strings

323

What’s Next?

325

Where Do You Go from Here?

328

The Mac User Interface

329

One Last Bit of Code

331

Go Get ’Em

333

Answers to Exercises

334

Chapter 4

335

Chapter 5

338

Chapter 6

339

Chapter 7

340

Chapter 8

341

Chapter 9

343

Chapter 10

344

Chapter 11

345

Index

347