# Learn C On The Macintosh 2nd Edition 1995 — source transcripts, page 1

[Canonical transcript page](https://www.vintageapple.net/transcripts/media/va-learn-c-on-the-macintosh-2nd-edition-1995-d8e261/1)

## Transcribed source material

Machine transcriptions and image descriptions; uncertain copy may be marked [illegible]. Verify against the linked originals. Historical rights remain with the original owners.

These are transcribed excerpts, not the full publications. Open the originals for remaining pages.

### Image 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-learn-c-on-the-macintosh-2nd-edition-1995-d8e261/1#scan-2d9eb58d994e9e64068c03207b6cf9cdd819de3a82d740398261c98e9ecddf13)

LEARN C ON THE MACINTOSH

Transcribed text:

DAVE MARK
LEARN
C
ON THE
MACINTOSH®
SECOND EDITION
Includes a Special Version of Metrowerks CodeWarrior™ Compiler

Image description: A book cover with a dark blue background, a copper-toned band at top bearing the author name DAVE MARK, a large white and brown stylized letter C, a red horizontal band, and a small compact disc graphic at lower right.

Reading notes: Line breaks between the large title words are inferred from layout; the title is stacked across the cover rather than set in a single line. Author name rendered in large dark letters on copper band; reading order top to bottom.

Languages: English

[Original Image 1](https://www.vintageapple.net/files/f71a0157bea117cb10aa9374cdd271b6de0d765be2a973cc78e11913ba1e7846/f2e0d1080b6f731f01313e89.webp)

### PDF page 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-learn-c-on-the-macintosh-2nd-edition-1995-d8e261/1#scan-ff3feb854172c48856165254ac8ec3651d966c40ad72d3fbd94995e083e84069)

Learn C on the Macintosh

Transcribed text:

DAVE MARK

LEARN

C

ON THE

MACINTOSH®

SECOND EDITION

Includes a Special Version of Metrowerks CodeWarrior™ Compiler

Image description: Book cover with a dark blue textured background, a large brown letter C with white and blue outline, a red horizontal band, a gold-tinted top band with the author name, and a compact disc icon at lower right.

Reading notes: The large C is a graphic letter; the 'ON THE' text sits inside the red band and the C is shown separately from 'LEARN' and 'MACINTOSH' in the layout.

Languages: English

[Original PDF page 1](https://www.vintageapple.net/files/4035efce2e966bef95ddb2da02ff413dcb6766971fbd37f22f6e07b02dbda949/Learn_C_On_The_Macintosh_2nd_Edition_1995.pdf#page=1)

### PDF page 2

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-learn-c-on-the-macintosh-2nd-edition-1995-d8e261/1#scan-416a1bf9b2d5ad7d2b143fcd1c06624d6a5c58a372fcac1c915ec45139886851)

Image description: The image is a entirely blank white page with no visible artwork, layout, or text.

Reading notes: No visible text or graphics appear anywhere on the page; the image may be a blank scan or an empty page.

[Original PDF page 2](https://www.vintageapple.net/files/4035efce2e966bef95ddb2da02ff413dcb6766971fbd37f22f6e07b02dbda949/Learn_C_On_The_Macintosh_2nd_Edition_1995.pdf#page=2)

### PDF page 3

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-learn-c-on-the-macintosh-2nd-edition-1995-d8e261/1#scan-39b43e4e80779d91e98a0121622fc6db0cc7980730c441e6e054deb96734c2b4)

Learn C on the Macintosh®

Transcribed text:

SECOND   EDITION
Learn   C   on the
Macintosh®
Dave Mark
... TT
ADDISON-WESLEY   PUBLISHING   COMPANY
Reading, Massachusetts   •   Menlo   Park,   California   •   New York   •   Don Mills, Ontario
Wokingham, England   •   Amsterdam   •   Bonn   •   Sydney   •   Singapore   •   Tokyo
Madrid   •   San   Juan   •   Paris   •   Seoul   •   Milan   •   Mexico City   •   Taipei

Printed product names: Macintosh®

Languages: English

[Original PDF page 3](https://www.vintageapple.net/files/4035efce2e966bef95ddb2da02ff413dcb6766971fbd37f22f6e07b02dbda949/Learn_C_On_The_Macintosh_2nd_Edition_1995.pdf#page=3)

### PDF page 4

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-learn-c-on-the-macintosh-2nd-edition-1995-d8e261/1#scan-2f68461acf8068022cdff604816c8a610f40f6386529e943bd2818dd72b02419)

Transcribed text:

Many of the designations used by manufacturers and sellers to distinguish their products
are claimed as trademarks. Where those designations appear in this book, and Addison-
Wesley was aware of a trademark claim, the designations have been printed in initial capi-
tal letters or all capital letters.
The author and publisher have taken care in preparation of this book, but make no ex-
pressed or implied warranty of any kind and assume no responsibility for errors or omis-
sions. No liability is assumed for incidental or consequential damages in connection with or
arising out of the use of the information or programs contained herein.
Appendix E supplied courtesy of Metrowerks Corporation.
Library of   Congress Cataloging-in-Publication Data
Mark, Dave.
Learn C on the Macintosh   I   Dave Mark. -   2nd ed.
p.   cm.
Includes bibliographical references and index.
ISBN   0-201-48406-4
1. Macintosh (Computer)-Programming.   2. C (Computer program
language)   I.   Title.
QA76.8.M3M36771861995
005.265-dc20   95-23299
CIP
Copyright© 1995 by Dave Mark
All rights reserved. No part of this publication may be reproduced, stored in a retrieval sys-
tem, or transmitted, in any form or by any means, electronic, mechanical, photocopying,
recording, or otherwise, without the prior written permission of the publisher. Printed in
the   United   States   of America.   Published   simultaneously in Canada.
Sponsoring Editor: Martha Steffen
Project Manager: John Fuller
Production   Coordinator: Ellen   Savett
Cover design: Andrew M. Newman
Text design: Wilson Graphics and Design (Kenneth J. Wilson)
Set in   10   point Palatino by Vicki L. Hochstedler
34567MA 00999897
3rd Printing   November, 1997
Addison-Wesley books are available for bulk purchases by corporations, institutions, and
other organizations. For more information please contact the Corporate, Government, and
Special   Sales   Department at   (800)   238-9682.

Reading notes: Printed date '1995' appears in multiple copyright and cataloging lines; distinct dates listed once in extraction OCR-style spacing irregularities in cataloging data such as 'QA76.8.M3M36771861995' and 'Library of   Congress'

Printed dates: 1995 · 1997

Languages: English

[Original PDF page 4](https://www.vintageapple.net/files/4035efce2e966bef95ddb2da02ff413dcb6766971fbd37f22f6e07b02dbda949/Learn_C_On_The_Macintosh_2nd_Edition_1995.pdf#page=4)

### PDF page 5

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-learn-c-on-the-macintosh-2nd-edition-1995-d8e261/1#scan-f93512de14a1cfe98a48f9d72b7475c03e82d7fc013b7080ce24338596fadab0)

Image description: The image is a entirely blank white page with no visible artwork, layout elements, or text.

Reading notes: No visible text found in the image; transcript and printed fields left empty.

[Original PDF page 5](https://www.vintageapple.net/files/4035efce2e966bef95ddb2da02ff413dcb6766971fbd37f22f6e07b02dbda949/Learn_C_On_The_Macintosh_2nd_Edition_1995.pdf#page=5)

### PDF page 6

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-learn-c-on-the-macintosh-2nd-edition-1995-d8e261/1#scan-b471d3e63ac45adc8ea96ac8415e9230eb0a1f71d1c872a28334d89f1544c154)

Transcribed text:

--------------Contents
Preface   xi
Acknowledgments   xiii
Chapter   1   Welcome   Aboard   1
What's   in   the   Package?   1
Why Learn C?   2
What Should You Know to Get Started?   2
What Equipment Will You Need?   3
The Lay of the Land   3
The Chapters   4
Conventions   Used   in   This Book   5
Strap   Yourself   In . . .   6
Chapter   2   Installing   and Testing CodeWarrior Lite   7
Installing CodeWarrior Lite   7
Testing CodeWarrior Lite   10
What's Next?   12
Chapter   3   Programming Basics   13
Reasons for Programming   13
Programming Languages   13
The Programming   Process   16
Flavors of   Object   Code   21
What's Next?   23
vii

Reading notes: Source is a table of contents excerpt; no advertised products, prices, or dates are printed. Hyphenation and extra spacing in the copy may reflect extraction artifacts rather than original typography.

Languages: English

[Original PDF page 6](https://www.vintageapple.net/files/4035efce2e966bef95ddb2da02ff413dcb6766971fbd37f22f6e07b02dbda949/Learn_C_On_The_Macintosh_2nd_Edition_1995.pdf#page=6)

### PDF page 7

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-learn-c-on-the-macintosh-2nd-edition-1995-d8e261/1#scan-7d35b0c57385435f1c329df6fb08eda6f769e55b14349317f95312c5e89dc837)

Transcribed text:

CONTENTS
viii
Chapter 4   C Basics: Functions   25
C Functions   25
ISO   C and the Standard Library   29
Same Program, Two Functions   31
Generating Some Errors   36
What's Next?   40
Exercises   40
Chapter   5   C Basics: Variables and Operators   43
An Introduction to Variables   43
Operators   SO
Operator   Order   57
Sample Programs   60
Sprucing   Up   Your Code   71
What's Next?   75
Exercises   75
Chapter 6   Controlling   Your Program's Flow   77
Flow Control   77
Expressions   79
Statements   86
Sample   Programs   104
What's Next?   110
Exercises   111
Chapter 7   Pointers and Parameters   113
What Is a   Pointer?   113
Pointer   Basics   116
Function Parameters   122
What Do Parameters Have to Do with Pointers?   128
Global Variables and Function Returns   131

Reading notes: Source appears to be a table of contents rather than advertising copy; no headline or advertised products or prices identified Some spacing irregularities in chapter titles (e.g., 'Operator   Order', 'Sprucing   Up   Your Code') may reflect extraction artifacts

Languages: English

[Original PDF page 7](https://www.vintageapple.net/files/4035efce2e966bef95ddb2da02ff413dcb6766971fbd37f22f6e07b02dbda949/Learn_C_On_The_Macintosh_2nd_Edition_1995.pdf#page=7)

### PDF page 8

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-learn-c-on-the-macintosh-2nd-edition-1995-d8e261/1#scan-e292702de243e60d8be0ef731c02ac2d51042fae5bef2fb25519e07cb0a50062)

Transcribed text:

More   Sample   Programs   139
What's Next?   147
Exercises   147
Chapter   a   Variable   Data Types   151
Other   Data Types   151
Working with Characters   162
Arrays   168
Text Strings   177
#define   183
A   Sample   Program: wordCount   188
What's Next?   194
Exercises   194
Chapter 9   Designing Your   Own   Data Structures   197
Using   Arrays (Model A)   197
Designing Data Structures (Model B)   209
Allocating Your Own Memory   223
Working with Linked Lists   228
What's Next?   241
Exercises   241
Chapter   10   Working with   Files   243
What Is a File?   243
Working with Files,   Part   One   243
Working with Files,   Part   Two   252
Working with Files,   Part   Three   266
What's Next?   278
Exercises   278
CONTENTS
ix

Reading notes: Source text is a table of contents with page numbers; no headline or advertised content is present. Some words are split by spacing and may need verification of exact spelling, e.g. 'Chapter a Variable Data Types' and 'Chapter   10'.

Languages: English

[Original PDF page 8](https://www.vintageapple.net/files/4035efce2e966bef95ddb2da02ff413dcb6766971fbd37f22f6e07b02dbda949/Learn_C_On_The_Macintosh_2nd_Edition_1995.pdf#page=8)

### PDF page 9

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-learn-c-on-the-macintosh-2nd-edition-1995-d8e261/1#scan-6271ec931f4c0f2b34a7b5ed8c3421947c67036f5802e1b434641d593958c082)

Transcribed text:

CONTENTS
x
Chapter 11   Advanced Topics   281
What Is Typecasting?   281
Unions   285
Function Recursion   289
Binary Trees   293
Function   Pointers   301
Initializers   303
The Remaining Operators   305
Creating Your   Own   Types   308
Static   Variables   310
More on   Strings   312
What's Next?   314
Exercises   314
Chapter 12   Where Do You Go from Here?   317
Appendixes
The Macintosh Graphical   User   Interface   317
Useful   Resources   322
Get On-line   324
Go Get 'Em   324
Appendix A
AppendixB
AppendixC
AppendixD
AppendixE
AppendixF
AppendixG
Index   467
Glossary   325
Source   Code Listings   337
CSyntax   Summary   413
Selections from the   Standard   Library   417
About CodeWarrior . . .   447
Answers to   Selected   Exercises   459
Bibliography   465

Reading notes: Source appears to be a table of contents; no headline or advertised products present. Some entries contain irregular internal spacing in the extracted text.

Languages: English

[Original PDF page 9](https://www.vintageapple.net/files/4035efce2e966bef95ddb2da02ff413dcb6766971fbd37f22f6e07b02dbda949/Learn_C_On_The_Macintosh_2nd_Edition_1995.pdf#page=9)

### PDF page 10

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-learn-c-on-the-macintosh-2nd-edition-1995-d8e261/1#scan-52a3eb13456af8b5b1f1789b2d22b2393a264c83021c06149e9b4045aebe8b58)

Transcribed text:

--------------Preface
One   of the best decisions I ever made was back   in   1979 when I hooked up with
my buddy Tom and learned   C.   At first, C was just a meaningless scribble of curly
brackets, semicolons, and parentheses. Fortunately for me, Tom was a C guru, and
with him looking over my shoulder, I learned C quickly.
Now it's your tum.
This time I'll be looking over your shoulder as you learn   C.   My goal is to pre-
sent every aspect of C the way I would have liked it explained to me. I've saved up
all the questions I had as I learned the language and tried to answer them here.
Learning to program   in   C will open a wide range of opportunities for you. C
is   one of the most popular programming languages   in   the world today. Recessions
may come and go, but there's always a demand for good C programmers.
Whether you want to start your own software company or just write programs for
your own enjoyment, you will discover that C programming is its own reward.
Most of all, C programming is fun.
I hope you enjoy the book.   If   you make it to MacWorld on either coast, stop by
the Addison-Wesley booth and say hello. I'd love to hear from you.   In   the mean-
time,   tum   the page, and let's get started....
D.M.
Arlington,   VA
xi

Reading notes: Source appears to be a book preface; OCR spacing and line breaks are irregular (e.g., 'tum' for 'turn', 'In' capitalization).

Printed dates: 1979

Languages: English

[Original PDF page 10](https://www.vintageapple.net/files/4035efce2e966bef95ddb2da02ff413dcb6766971fbd37f22f6e07b02dbda949/Learn_C_On_The_Macintosh_2nd_Edition_1995.pdf#page=10)

### PDF page 11

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-learn-c-on-the-macintosh-2nd-edition-1995-d8e261/1#scan-4f1d06799b7fbaeb37a1fd27c6e7bf38faf3cb6f8d0141f806ac48a346790c05)

Transcribed text:

-----------Acknowledgments
I  1
d like to take a paragraph or two and thank some people whose names didn't
make the cover, but who made this book possible. First of all, I'd like to thank
Keith Rollin, whose technical review made this book so much better. Thanks,
Keith. I owe you big!
Next, I'd like to thank all the folks at Addison-Wesley for their time, dedica-
tion, and just plain hard work. People like Keith Wollman, Martha Steffen, Kaethin
Prizer, John Fuller, and Ellen   Savett   do the work that gets this book from my Mac
into your hands.
Next, I'd like to thank Greg Galanos, Greg Dow, Berardino Baratta, Avi
Rappaport, and the rest of the folks at Metrowerks for their support. Not only did
they provide the copy of CodeWarrior you'll use to run all the examples in this
book but they answered all my questions when Keith wasn't available.
Thanks to   Stu   Mark who put together the CD in back of the book and alter-
nated between bass, drums, and lead guitar to keep me from getting bored.   Stu,
I'm lucky to have you for a brother!
A special thanks to Deneen and Daniel for letting me burn the midnight oil
without complaint. And thanks to Hersh, Beth, Jackson, and Caroline   Porter   for
being such great friends and neighbors.
Finally, I'd like to thank the man who was there at the beginning, the man who
introduced me to the wonders of C, my good friend Tom   Swartz.   Thanks, Tom.
xiii

Reading notes: Page number '1' and 'xiii' appear as stray marks within the text; reading order may be uncertain.

Printed product names: CodeWarrior

Languages: English

[Original PDF page 11](https://www.vintageapple.net/files/4035efce2e966bef95ddb2da02ff413dcb6766971fbd37f22f6e07b02dbda949/Learn_C_On_The_Macintosh_2nd_Edition_1995.pdf#page=11)

[Next transcribed scans](https://www.vintageapple.net/transcripts/media/va-learn-c-on-the-macintosh-2nd-edition-1995-d8e261/2.md)
