Author(s): Stephen G. Kochan
Edition: 3rd
Publisher: Sams Publishing
Year: 2005
Language: English
Pages: 564
Programming in C, Third Edition......Page 2
Copyright © 2005 by Sams Publishing......Page 5
Contents At a Glance......Page 7
Table of Contents......Page 8
Preface......Page 18
About the Author......Page 19
We Want to Hear from You......Page 21
Chapter 1 Introduction......Page 22
Programming......Page 26
Operating Systems......Page 27
Compiling Programs......Page 28
Language Interpreters......Page 31
Compiling Your Program......Page 32
Running Your Program......Page 33
Understanding Your First Program......Page 34
Displaying the Values of Variables......Page 36
Comments......Page 38
Exercises......Page 40
Working with Variables......Page 42
Understanding Data Types and Constants......Page 44
Working with Arithmetic Expressions......Page 51
Combining Operations with Assignment:The Assignment Operators......Page 59
Types _Complex and _Imaginary......Page 60
Exercises......Page 61
Chapter 5 Program Looping......Page 64
The for Statement......Page 65
The while Statement......Page 77
The do Statement......Page 81
Exercises......Page 84
The if Statement......Page 86
The switch Statement......Page 105
Boolean Variables......Page 108
The Conditional Operator......Page 112
Exercises......Page 114
Chapter 7 Working with Arrays......Page 116
Defining an Array......Page 117
Initializing Arrays......Page 127
Character Arrays......Page 129
Multidimensional Arrays......Page 134
Variable-Length Arrays1......Page 136
Exercises......Page 138
Defining a Function......Page 140
Arguments and Local Variables......Page 143
Returning Function Results......Page 147
Functions Calling Functions Calling…......Page 152
Functions and Arrays......Page 158
Global Variables......Page 173
Automatic and Static Variables......Page 177
Recursive Functions......Page 180
Exercises......Page 183
Chapter 9 Working with Structures......Page 186
A Structure for Storing the Date......Page 187
Functions and Structures......Page 192
Initializing Structures......Page 201
Arrays of Structures......Page 203
Structures Containing Structures......Page 206
Structures Containing Arrays......Page 208
Structure Variants......Page 211
Exercises......Page 212
Chapter 10 Character Strings......Page 216
Arrays of Characters......Page 217
Variable-Length Character Strings......Page 219
Escape Characters......Page 237
More on Constant Strings......Page 239
Character Strings, Structures, and Arrays......Page 240
Character Operations......Page 248
Exercises......Page 251
Defining a Pointer Variable......Page 256
Using Pointers in Expressions......Page 260
Working with Pointers and Structures......Page 261
The Keyword const and Pointers......Page 274
Pointers and Functions......Page 275
Pointers and Arrays......Page 280
Operations on Pointers......Page 293
Pointers to Functions......Page 294
Pointers and Memory Addresses......Page 295
Exercises......Page 297
Chapter 12 Operations on Bits......Page 300
Bit Operators......Page 301
Bit Fields......Page 313
Exercises......Page 318
The #define Statement......Page 320
The #include Statement......Page 334
Conditional Compilation......Page 337
Exercises......Page 341
Enumerated Data Types......Page 342
The typedef Statement......Page 346
Data Type Conversions......Page 348
Exercises......Page 351
Dividing Your Program into Multiple Files......Page 354
Communication Between Modules......Page 357
Other Utilities for Working with Larger Programs......Page 363
Chapter 16 Input and Output Operations in C......Page 368
Formatted I/O: printf and scanf......Page 369
Input and Output Operations with Files......Page 380
Special Functions for Working with Files......Page 384
Exercises......Page 392
Miscellaneous Language Statements......Page 394
Working with Unions......Page 396
Type Qualifiers......Page 399
Command-Line Arguments......Page 401
Dynamic Memory Allocation......Page 404
Debugging with the Preprocessor......Page 410
Debugging Programs with gdb......Page 416
What Is an Object Anyway?......Page 432
Instances and Methods......Page 433
Writing a C Program to Work with Fractions......Page 434
Defining an Objective-C Class to Work with Fractions......Page 435
Defining a C++ Class to Work with Fractions......Page 440
Defining a C# Class to Work with Fractions......Page 443
1.0 Digraphs and Identifiers......Page 446
2.0 Comments......Page 447
3.0 Constants......Page 448
4.0 Data Types and Declarations......Page 451
5.0 Expressions......Page 460
6.0 Storage Classes and Scope......Page 473
7.0 Functions......Page 475
8.0 Statements......Page 477
9.0 The Preprocessor......Page 481
Standard Header Files......Page 488
String Functions......Page 491
Memory Functions......Page 493
I/O Functions......Page 494
In-Memory Format Conversion Functions......Page 499
String-to-Number Conversion......Page 500
Dynamic Memory Allocation Functions......Page 502
Math Functions......Page 503
General Utility Functions......Page 511
General Command Format......Page 514
Command-Line Options......Page 515
Appendix D Common Programming Mistakes......Page 518
The C Programming Language......Page 522
C Compilers and Integrated Development Environments......Page 523
Miscellaneous......Page 524
Index......Page 526