Cover image for The complete book of C programming
Title:
The complete book of C programming
Author:
Austell-Wolfson, Barry.
Personal Author:
Publication Information:
Upper Saddle River, N.J. : Prentice Hall, [2000]

©2000
Physical Description:
xvi, 1005 pages : illustrations ; 28 cm + 1 computer optical disc (4 3/4 in.)
General Note:
Includes index.
Language:
English
Added Author:
ISBN:
9780130960931
Format :
Book

Available:*

Library
Call Number
Material Type
Home Location
Status
Item Holds
Searching...
QA76.73.C15 A97 2000 TEXT Adult Non-Fiction Non-Fiction Area-Oversize
Searching...

On Order

Summary

Summary

A core text for courses in Introduction to Programming (using C), Structured Programming, Beginning, Intermediate and Advanced C Programming, and a supplementary text for courses in Data Structures.

The most comprehensive book available on the subject, this text is designed to serve as a teaching tool now and detailed reference book later. It teaches students how to design and write portable elementary, intermediate, and advanced batch and interactive ANSI C programs in their entirety. The text and accompanying programs comprise a total package designed to satisfy all ANSI C needs in any of the programming environments that embrace the C Standard. This book is the most complete one ever published.


Table of Contents

Chapter 1 Building Blocksp. 1
1.1 Hardwarep. 2
1.2 Programsp. 4
1.3 Computer Programming Methodology and the Design Processp. 5
1.4 Structured Programming Methodologyp. 11
1.5 Application: Programming Specificationsp. 15
1.6 Application: Solutionp. 17
1.7 C Language Introduction: The Source Codep. 19
1.8 Application: ACE Billing Programp. 27
Chapter 2 Using Variablesp. 57
2.1 Variable Namesp. 58
2.2 Variable Typesp. 60
2.3 Bits and Bytesp. 61
2.4 Letters and Other Numbersp. 63
2.5 Variable Declaration Statementsp. 64
2.6 Assignment Statementsp. 65
2.7 Assigning Constants--Floating Pointp. 66
2.8 Assigning Constants--Integersp. 68
2.9 Application: ACE Billing Programp. 73
Chapter 3 Introduction to I/Op. 81
3.1 The printf () Functionp. 82
3.2 Nonprinting Characters--Escape Sequencesp. 84
3.3 Argument Evaluation: Matching Specifiers and Argumentsp. 87
3.4 Integer and Floating Point Type Size Variationsp. 89
3.5 Octal and Hexadecimalp. 90
3.6 Exponential Notationp. 91
3.7 Modifiersp. 92
3.8 Long Format Stringsp. 98
3.9 The scanf () Functionp. 100
3.10 Conversion Specificationsp. 101
3.11 Mechanics of scanf ()p. 102
3.12 The %c Conversion Specifierp. 104
3.13 Characters between Conversion Specifiersp. 104
3.14 Modifiersp. 106
3.15 Conversion Specifier Examplesp. 108
3.16 What Stops scanf ()p. 114
3.17 The getchar () and putchar () Functionsp. 116
3.18 The scanf () and getchar () Functions: Same Input Streamp. 117
3.19 Buffering--getchar () versus getch () versus getche ()p. 118
3.20 Application: ACE Billing Programp. 120
Chapter 4 Expressions, Operators, and Type Conversionp. 141
4.1 Mathematical Operatorsp. 141
4.2 Assignment-Mathematical Operator Combinationsp. 143
4.3 Increment and Decrement Operatorp. 143
4.4 Unary Sign Operatorsp. 145
4.5 Operator Precedence and Associativityp. 145
4.6 Combining Assignments and Statements with Assignment Operators and Comma Operatorsp. 146
4.7 Expressionsp. 147
4.8 The sizeof Operatorp. 148
4.9 Type Conversions and Castingp. 149
Chapter 5 Loops and Conditional Statementsp. 155
5.1 if Statementsp. 155
5.2 Logical Operators: Multiple Conditionsp. 159
5.3 The ! Operatorp. 161
5.4 Alternatives: if . . . else if . . . elsep. 162
5.5 Nesting if Statementsp. 164
5.6 Conditional Operatorp. 165
5.7 The switch Statementp. 168
5.8 switch versus if . . . elsep. 173
5.9 Loopsp. 174
5.10 while Loopp. 175
5.11 for Loopp. 179
5.12 do-while Loopsp. 192
5.13 Choosing Your Loopp. 192
5.14 Periodic Change and Cycling with / and %p. 193
5.15 Nested Loopsp. 193
5.16 Using continue and break: Loop Short-Circuitp. 195
5.17 The goto Statementp. 201
5.18 Application: ACE Billing Programp. 202
Chapter 6 Arraysp. 219
6.1 Array Declarationp. 220
6.2 Assignment of Array Elementsp. 221
6.3 Use of Array Elementsp. 223
6.4 Using a for Loop for Array Traversalp. 223
6.5 Sortingp. 224
6.6 Array Initializationp. 226
6.7 Multidimensional Arraysp. 228
6.8 More Than Two Dimensionsp. 232
6.9 Three-Dimensional Array Applicationp. 233
6.10 Application: ACE Billing Programp. 235
Chapter 7 Pointers and Stringsp. 257
7.1 Declaring Pointersp. 259
7.2 Pointer Assignmentp. 259
7.3 Altering and Using Pointed-to Valuesp. 260
7.4 Recap: Three Different Uses of the Indirection Operatorp. 261
7.5 Pointer Arithmeticp. 262
7.6 Pointers to voidp. 267
7.7 Stringsp. 268
7.8 Strings--Literal Stringsp. 268
7.9 Strings--Arrays; the strlen () Functionp. 270
7.10 Strings--Pointersp. 272
7.11 Array versus Pointerp. 272
7.12 String Arrays: Array of Arrays or Array of Pointersp. 275
7.13 Double Indirection: Pointers to Pointersp. 278
Chapter 8 Functionsp. 289
8.1 Program Execution and Function Callsp. 289
8.2 Why Use Functions?p. 290
8.3 Structure of a Functionp. 290
8.4 Function Declaration (Prototype)p. 291
8.5 Function Definitionp. 294
8.6 Old Style Declarations and Definition Headers (Optional)p. 297
8.7 Function Callsp. 297
8.8 Return Statementsp. 300
8.9 Making Use of the Return Valuep. 303
8.10 Recursionp. 305
8.11 Addresses and Functionsp. 315
8.12 Arrays and Functionsp. 318
8.13 Pointers to Functions (Optional)p. 326
8.14 Variable Number of Arguments (Optional)p. 332
8.15 Application: ACE Billing Programp. 345
Chapter 9 String-Handling and Buffer Functionsp. 358
9.1 Summary of String and Buffer Functionsp. 358
9.2 The gets () Functionp. 361
9.3 The puts () Functionp. 366
9.4 The strcpy () Functionp. 366
9.5 The stract () Functionp. 369
9.6 The strcmp () Functionp. 371
9.7 Limiting the Number of Charactersp. 374
9.8 Character and String Locators and Parsersp. 376
9.9 The sprintf () Functionp. 379
9.10 The sscanf () Functionp. 382
9.11 String-Number Conversionp. 385
9.12 Number-String Conversionp. 388
9.13 Application: Name and Date Shufflingp. 390
9.14 Character Classification Checking and Case Conversionp. 394
9.15 Buffer Functions--Manipulating Memory Blocks with Pointers to void (Optional)p. 401
9.16 Application: ACE Billing Programp. 405
Chapter 10 Scope and Durationp. 419
10.1 General Scope and Duration Rulesp. 419
10.2 Using Global Variablesp. 420
10.3 Block Scopep. 424
10.4 Durationp. 427
10.5 Static External Variablesp. 430
10.6 Complex Data Typesp. 431
10.7 Scalar and Complex Variable Default Valuesp. 432
10.8 Register Variables (Optional)p. 434
10.9 Type Qualifiers (Optional)p. 434
10.10 Order of Specifiers and Qualifiersp. 438
10.11 Scope of Functionsp. 438
Chapter 11 The Preprocessorp. 442
11.1 Formatp. 442
11.2 The include Directivep. 443
11.3 The define Directive--Manifest Constantsp. 445
11.4 Conditional Directivesp. 452
11.5 Macros with Argumentsp. 458
11.6 The #error Directive (Optional)p. 466
11.7 Using__Line__ and__File__ (Optional)p. 468
11.8 More Sophisticated Debugging and Testing: assert Macro (Optional)p. 470
11.9 Other Predefined Macros (Optional)p. 471
11.10 Debugging Preprocessor Directives (Optional)p. 472
11.11 Pragmas (Optional)p. 472
11.12 Application: ACE Billing Programp. 473
Chapter 12 Byte Structure and Bit Manipulationp. 485
12.1 Bits and Bytesp. 486
12.2 Octal and Hexadecimal Numbersp. 490
12.3 Floating Point Numbersp. 492
12.4 Bitwise Operators (Optional)p. 497
12.5 ~ Operator (Optional)p. 497
12.6 | Operator (Optional)p. 498
12.7 and Operator (Optional)p. 499
12.8 Bit Masks (Optional)p. 499
12.9 Turning Designated Bits Off: num and= MASK (Optional)p. 499
12.10 Determining Whether One or More Bits are On: if (num and MASK == MASK) (Optional)p. 502
12.11 Ascertaining the Value of Several Bits at Once: num and MASK (Optional)p. 503
12.12 Turning Designated Bits on: num |= MASK (Optional)p. 504
12.13 ^ Operator (Optional)p. 504
12.14 Toggling Bits: num ^= MASK (Optional)p. 504
12.15 Bitwise Shift Operators (Optional)p. 505
12.16 Simplified Masking with Bit Shift Operations (Optional)p. 511
Chapter 13 Complex Data Types and Type Conversionp. 520
13.1 Structure Templatep. 521
13.2 Declaring Structure Variablesp. 522
13.3 Name Duplicationp. 523
13.4 Permissible Members and Variable Typesp. 525
13.5 Accessing, Initializing, and Assignmentp. 527
13.6 Pointers to Structuresp. 533
13.7 Accessing Structure Members by Pointerp. 534
13.8 Structures and Functionsp. 535
13.9 Data Alignment and the sizeof Operatorp. 540
13.10 Scope and Storage Classesp. 544
13.11 Bit Fields (Optional)p. 549
13.12 Unions (Optional)p. 554
13.13 Applications--Structuresp. 565
13.14 Enumerated Types (Optional)p. 567
13.15 Using typedef--Aliasesp. 571
13.16 Complex Declarations (Optional)p. 574
13.17 Type Conversion (Optional)p. 574
13.18 Application: ACE Billing Programp. 580
Chapter 14 Filesp. 591
14.1 Files versus RAMp. 592
14.2 Standard I/O--Text versus Binary Functionsp. 593
14.3 Opening a Filep. 594
14.4 Text File Modesp. 596
14.5 Closing the File: fclose () and freopen ()p. 597
14.6 Text versus Binary Modep. 599
14.7 Text Functions--fprintf () and fscanf ()p. 602
14.8 Binary Functions--fwrite () and fread ()p. 608
14.9 Text or Binary Functions?p. 610
14.10 Random Accessp. 613
14.11 Random Access with Text Mode (Optional)p. 617
14.12 Buffer Flushing in Update Modesp. 618
14.13 Dealing with I/O Errors: clearerr (), feof (), ferror ()p. 620
14.14 An Update Trick (Optional)p. 621
14.15 Manipulating File Buffers--setvbuf () (Optional)p. 623
14.16 Application: Reading and Writing Recordsp. 625
14.17 Portability Issuesp. 632
14.18 Miscellaneous File-Housekeeping Functions (Optional)p. 534
14.19 Application: ACE Billing Programp. 635
Chapter 15 Dynamic Data Structures and Memory Allocationp. 674
15.1 The malloc () Functionp. 675
15.2 Allocating Memory and Initializing to Zeros: calloc ()p. 678
15.3 Freeing a Memory Blockp. 681
15.4 Linked Listsp. 682
15.5 Database Files--Fixed-Size Record Storagep. 685
15.6 Variable-Size Records--Field-Length Separatorp. 692
15.7 Variable-Size Records--Character Separatorp. 695
15.8 Double-Linked Listp. 702
15.9 Linked-List Variationsp. 710
15.10 Binary Trees: Nonlinear Linked Listsp. 711
Chapter 16 Working with the Systemp. 725
16.1 Library Function Error-Checking: errnop. 725
16.2 Running System Commands from Your Program: system ()p. 729
16.3 Premature Program Termination: abort () and exit ()p. 730
16.4 Invoking main (): Command-Line Argumentsp. 734
16.5 The Environment (Optional)p. 740
16.6 Redirectionp. 743
16.7 Time and Datep. 746
Chapter 17 Projects and Program Chainingp. 752
17.1 An Overview of Projects and Librariesp. 752
17.2 Advantagesp. 753
17.3 Project File Mechanicsp. 754
17.4 Consistency and Initialization of External Variables in Multiple Filesp. 757
17.5 Creating a Library in Borland C (Optional)p. 758
17.6 Chaining and Overlaying Programsp. 758
Appendixes
A Controlling the PC Console--Escape Sequencesp. 761
B Memory and Interrupts on the PCp. 785
C Video Services Interrupts on the PCp. 821
D Direct Memory Access on the PCp. 869
E Graphics Mode and the Mouse on the PCp. 880
F ASCII/EBCDIC Charactersp. 921
G Extended Keyboard Codesp. 936
H Header Files--Define Directivesp. 939
I Standard C Functionsp. 943
J Operator Precedence and Associativityp. 957
K Low-Level I/O and Other File and Disk Operationsp. 958
L Program Chaining with exec () and spawn ()p. 970
Indexp. 992