| |
| |
Preface | |
| |
| |
| |
Introduction | |
| |
| |
| |
Introduction | |
| |
| |
| |
The C Programming Language | |
| |
| |
| |
CStandard Library | |
| |
| |
| |
C++ and Other C-Based Languages | |
| |
| |
| |
Typical C Program Development Environment | |
| |
| |
| |
Test-Driving a C Application in Windows, Linux and Mac OS X | |
| |
| |
| |
Operating Systems | |
| |
| |
| |
Introduction to C Programming | |
| |
| |
| |
Introduction | |
| |
| |
| |
ASimple C Program: Printing a Line of Text | |
| |
| |
| |
Another Simple C Program: Adding Two Integers | |
| |
| |
| |
Arithmetic in C | |
| |
| |
| |
Decision Making: Equality and Relational Operators | |
| |
| |
| |
Secure C Programming | |
| |
| |
| |
Control Statements: Part I | |
| |
| |
| |
Introduction | |
| |
| |
| |
Control Structures | |
| |
| |
| |
The if Selection Statement | |
| |
| |
| |
The if…else Selection Statement | |
| |
| |
| |
The while Repetition Statement | |
| |
| |
| |
Class Average with Counter-Controlled Repetition | |
| |
| |
| |
Class Average with Sentinel-Controlled Repetition | |
| |
| |
| |
Nested Control Statements | |
| |
| |
| |
Assignment Operators | |
| |
| |
| |
Increment and Decrement Operators | |
| |
| |
| |
Secure C Programming | |
| |
| |
| |
Control Statements: Part II | |
| |
| |
| |
Introduction | |
| |
| |
| |
Repetition Essentials | |
| |
| |
| |
Counter-Controlled Repetition | |
| |
| |
| |
for Repetition Statement | |
| |
| |
| |
for Statement: Notes and Observations | |
| |
| |
| |
Examples Using the for Statement | |
| |
| |
| |
switch Multiple-Selection Statement | |
| |
| |
| |
do…while Repetition Statement | |
| |
| |
| |
break and continue Statements | |
| |
| |
| |
Logical Operators | |
| |
| |
| |
Confusing Equality (==) and Assignment (=) Operators | |
| |
| |
| |
Secure C Programming | |
| |
| |
| |
Functions | |
| |
| |
| |
Introduction | |
| |
| |
| |
Program Modules in C | |
| |
| |
| |
Math Library Functions | |
| |
| |
| |
Functions | |
| |
| |
| |
Function Definitions | |
| |
| |
| |
Function Prototypes: A Deeper Look | |
| |
| |
| |
Function Call Stack and Stack Frames | |
| |
| |
| |
Headers | |
| |
| |
| |
Passing Arguments By Value and By Reference | |
| |
| |
| |
Random Number Generation | |
| |
| |
| |
Example: A Game of Chance | |
| |
| |
| |
Storage Classes | |
| |
| |
| |
Scope Rules | |
| |
| |
| |
Recursion | |
| |
| |
| |
Example Using Recursion: Fibonacci Series | |
| |
| |
| |
Recursion vs. Iteration | |
| |
| |
| |
Secure C Programming | |
| |
| |
| |
Arrays | |
| |
| |
| |
Introduction | |
| |
| |
| |
Arrays | |
| |
| |
| |
Defining Arrays | |
| |
| |
| |
Array Examples | |
| |
| |
| |
Passing Arrays to Functions | |
| |
| |
| |
Sorting Arrays | |
| |
| |
| |
Case Study: Computing Mean, Median and Mode Using Arrays | |
| |
| |
| |
Searching Arrays | |
| |
| |
| |
Multidimensional Arrays | |
| |
| |
| |
Variable-Length Arrays | |
| |
| |
| |
Secure C Programming | |
| |
| |
| |
Pointers | |
| |
| |
| |
Introduction | |
| |
| |
| |
Pointer Variable Definitions and Initialization | |
| |
| |
| |
Pointer Operators | |
| |
| |
| |
Passing Arguments to Functions by Reference | |
| |
| |
| |
Using the const Qualifier with Pointers | |
| |
| |
| |
Bubble Sort Using Pass-by-Reference | |
| |
| |
| |
sizeof Operator | |
| |
| |
| |
Pointer Expressions and Pointer Arithmetic | |
| |
| |
| |
Relationship between Pointers and Arrays | |
| |
| |
| |
Arrays of Pointers | |
| |
| |
| |
Case Study: Card Shuffling and Dealing Simulation | |
| |
| |
| |
Pointers to Functions | |
| |
| |
| |
Secure C Programming | |
| |
| |
| |
Characters and Strings | |
| |
| |
| |
Introduction | |
| |
| |
| |
Fundamentals of Strings and Characters | |
| |
| |
| |
Character-Handling Library | |
| |
| |
| |
String-Conversion Functions | |
| |
| |
| |
Standard Input/Output Library Functions | |
| |
| |
| |
String-Manipulation Functions of the String-Handling Library | |
| |
| |
| |
Comparison Functions of the String-Handling Library | |
| |
| |
| |
Search Functions of the String-Handling Library | |
| |
| |
| |
Memory Functions of the String-Handling Library | |
| |
| |
| |
Other Functions of the String-Handling Library | |
| |
| |
| |
Secure C Programming | |
| |
| |
| |
Formatted Input/Output | |
| |
| |
| |
Introduction | |
| |
| |
| |
Streams | |
| |
| |
| |
Formatting Output with printf | |
| |
| |
| |
Printing Integers | |
| |
| |
| |
Printing Floating-Point Numbers | |
| |
| |
| |
Printing Strings and Characters | |
| |
| |
| |
Other Conversion Specifiers | |
| |
| |
| |
Printing with Field Widths and Precision | |
| |
| |
| |
Using Flags in the printf Format Control String | |
| |
| |
| |
Printing Literals and Escape Sequences | |
| |
| |
| |
Reading Formatted Input with scanf | |
| |
| |
| |
Secure C Programming | |
| |
| |
| |
Structures, Unions, Bit Manipulation and Enumerations | |
| |
| |
| |
Introduction | |
| |
| |
| |
Structure Definitions | |
| |
| |
| |
Initializing Structures | |
| |
| |
| |
Accessing Structure Members | |
| |
| |
| |
Using Structures with Functions | |
| |
| |
| |
typedef | |
| |
| |
| |
Example: High-Performance Card Shuffling and Dealing Simulation | |
| |
| |
| |
Unions | |
| |
| |
| |
Bitwise Operators | |
| |
| |
| |
Bit Fields | |
| |
| |
| |
Enumeration Constants | |
| |
| |
| |
Secure C Programming | |
| |
| |
| |
File Processing | |
| |
| |
| |
Introduction | |
| |
| |
| |
Files and Streams | |
| |
| |
| |
Creating a Sequential-Access File | |
| |
| |
| |
Reading Data from a Sequential-Access File | |
| |
| |
| |
Random-Access Files | |
| |
| |
| |
Creating a Random-Access File | |
| |
| |
| |
Writing Data Randomly to a Random-Access File | |
| |
| |
| |
Reading Data from a Random-Access File | |
| |
| |
| |
Case Study: Transaction-Processing Program | |
| |
| |
| |
Secure C Programming | |
| |
| |
| |
Data Structures | |
| |
| |
| |
Introduction | |
| |
| |
| |
Self-Referential Structures | |
| |
| |
| |
Dynamic Memory Allocation | |
| |
| |
| |
Linked Lists | |
| |
| |
| |
Stacks | |
| |
| |
| |
Queues | |
| |
| |
| |
Trees | |
| |
| |
| |
Secure C Programming | |
| |
| |
| |
Preprocessor | |
| |
| |
| |
Introduction | |
| |
| |
| |
#include Preprocessor Directive | |
| |
| |
| |
#define Preprocessor Directive: Symbolic Constants | |
| |
| |
| |
#define Preprocessor Directive: Macros | |
| |
| |
| |
Conditional Compilation | |
| |
| |
| |
#error and #pragma Preprocessor Directives | |
| |
| |
| |
# and ## Operators | |
| |
| |
| |
Line Numbers | |
| |
| |
| |
Predefined Symbolic Constants | |
| |
| |
| |
Assertions | |
| |
| |
| |
Secure C Programming | |
| |
| |
| |
Other Topics | |
| |
| |
| |
Introduction | |
| |
| |
| |
Redirecting I/O | |
| |
| |
| |
Variable-Length Argument Lists | |
| |
| |
| |
Using Command-Line Arguments | |
| |
| |
| |
Notes on Compiling Multiple-Source-File Programs | |
| |
| |
| |
Program Termination with exit and atexit | |
| |
| |
| |
Suffixes for Integer and Floating-Point Literals | |
| |
| |
| |
Signal Handling | |
| |
| |
| |
Dynamic Memory Allocation: Functions calloc and realloc | |
| |
| |
| |
Unconditional Branching with goto | |
| |
| |
| |
Operator Precedence Chart | |
| |
| |
| |
ASCII Character Set | |
| |
| |
| |
Number Systems | |
| |
| |
| |
Introduction | |
| |
| |
| |
Abbreviating Binary Numbers as Octal and Hexadecimal Numbers | |
| |
| |
| |
Converting Octal and Hexadecimal Numbers to Binary Numbers | |
| |
| |
| |
Converting from Binary, Octal or Hexadecimal to Decimal | |
| |
| |
| |
Converting from Decimal to Binary, Octal or Hexadecimal | |
| |
| |
| |
Negative Binary Numbers: Two's Complement Notation | |
| |
| |
| |
Sorting: A Deeper Look | |
| |
| |
| |
Introduction | |
| |
| |
| |
Big O Notation | |
| |
| |
| |
Selection Sort | |
| |
| |
| |
Insertion Sort | |
| |
| |
| |
Merge Sort | |
| |
| |
| |
Additional Features of the C Standard | |
| |
| |
| |
Introduction | |
| |
| |
| |
Support for C99 | |
| |
| |
| |
C99 Headers | |
| |
| |
| |
Mixing Declarations and Executable Code | |
| |
| |
| |
Declaring a Variable in a for Statement Header | |
| |
| |
| |
Designated Initializers and Compound Literals | |
| |
| |
| |
Type bool | |
| |
| |
| |
Implicit int in Function Declarations | |
| |
| |
| |
Complex Numbers | |
| |
| |
| |
Variable-Length Arrays | |
| |
| |
| |
Additions to the Preprocessor | |
| |
| |
| |
Other C99 Features | |
| |
| |
| |
New Features in the C11 Standard | |
| |
| |
| |
Web Resources | |
| |
| |
| |
Using the Visual Studio Debugger | |
| |
| |
| |
Introduction | |
| |
| |
| |
Breakpoints and the Continue Command | |
| |
| |
| |
Locals and Watch Windows | |
| |
| |
| |
Controlling Execution Using the Step Into, Step Over, Step Out and Continue Commands | |
| |
| |
| |
Autos Window | |
| |
| |
| |
Using the GNU Debugger | |
| |
| |
| |
Introduction | |
| |
| |
| |
Breakpoints and the run, stop, continue and print Commands | |
| |
| |
| |
print and set Commands | |
| |
| |
| |
Controlling Execution Using the step, finish and next Commands | |
| |
| |
| |
watch Command | |
| |
| |
Index | |