Amiga_C_for_Beginners.pdf

(15544 KB) Pobierz
199409786 UNPDF
199409786.002.png
199409786.003.png
Amiga
CforBeginners
. >'
Schaun
A Data Becker Book
199409786.004.png
Fourth Printing, 1990
Printed in U.S.A.
Copyright © 1989,1990
Abacus
5370 52ndStreet, SE
GrandRapids,MI49512
Copyright © 1987,1988
DataBeckerGmbH
Merowingerstrasse30
4000Duesseldorf,WestGermany
This book is copyrighted. No part of this book may be reproduced, stored in a retrieval
system, ortransmitted in any form orby any means,electronic, mechanical,photocopying,
recording or otherwise, without the prior written permission of Abacus or Data Becker
GmbH.
Every effort has been made to ensure complete and accurate information concerning the
materialpresentedin thisbook. However, Abacuscanneitherguaranteenorbeheldlegally
responsible for any mistakes in printing or faulty instructions contained in this book. The
authorsalwaysappreciatereceivingnoticeofanyerrorsormisprints.
AmigaBASICisatrademarkorregisteredtrademarkofMicrosoftCorporation. Amiga500,
Amiga 1000, Amiga 2000, Amiga and C64 are trademarks or registered trademarks of
Commodore-Amiga, Inc. LatticeC andLattice are trademarks orregistered trademarks of
LatticeCorporation. Aztec C and Aztec are trademarks orregistered trademarks ofManx
Software Systems. IBM is a trademark or registered trademark of International Business
Machines,Inc.AtariSTisatrademarkorregisteredtrademarkofAtariCorporation.
ISBN 1-55755-045-X
ii
199409786.005.png
Table of Contents
1. Introduction to C
1
1.1 ProgramExecution
4
1.2 Compiler vs. Interpreter
5
2. Beginning C
7
2.1 The Editor
10
2.2 TheCompiler
11
2.3 TheLinker
12
2.4 Putting It All Together
13
3. The FirstProgram
15
3.1 Using ED
,
18
3.2 Compiling
19
3.3 ErrorMessages
21
r
4. Theory and Practice
23
4.1 Program Format
27
4.2 Defining a Function
28
4.3 printf andEscapeSequences
29
4.4 Comments
30
4.5 Variables and Arithmetic
31
4.5.1 Integers
31
4.5.2 The if statement
32
4.5.3 Calculating with C
35
4.5.4 Floating Point Numbers
37
4.5.5 Characters and Character Strings
39
5. Loops
43
5.1 while Loops
45
5.2 for Loops
48
5.3 do while Loops
49
5.3.1 MoreErrorChecking
."!".!"52
6. Strings
55
6.1 Backtracking
57
7. Calculating in C
,
59
8. Variables
63
8.1 Variable Names
65
8.2 Data Types
67
8.4 ThecastOperator
."........!!71
70
Hi
5.4 ANDandOR
49
8.3 Type Conversion
199409786.001.png
Zgłoś jeśli naruszono regulamin