Foreword | p. xvii |
Foreword | p. xix |
Acknowledgments | p. xxi |
Introduction | p. xxiii |
A Brief History of C | p. xxiv |
The C Standard | p. xxv |
The CERT C Coding Standard | p. xxvi |
Who This Book Is For | p. xxvi |
What's in This Book | p. xxvi |
Getting Started With C | p. 1 |
Developing Your First C Program | p. 1 |
Compiling and Running Your Program | p. 2 |
Preprocessor Directives | p. 3 |
The main Function | p. 3 |
Checking Function Return Values | p. 5 |
Formatted Output | p. 5 |
Editors and Integrated Development Environments | p. 6 |
Compilers | p. 8 |
GNU Compiler Collection | p. 8 |
Clang | p. 8 |
Microsoft Visual Studio | p. 9 |
Portability | p. 9 |
Implementation-Defined Behavior | p. 10 |
Unspecified Behavior | p. 10 |
Undefined Behavior | p. 10 |
Locale-Specific Behavior and Common Extensions | p. 11 |
Summary | p. 11 |
Objects, Functions, and Types | p. 13 |
Objects, Functions, Types, and Pointers | p. 13 |
Declaring Variables | p. 14 |
Swapping Values (First Attempt) | p. 15 |
Swapping Values (Second Attempt) | p. 16 |
Scope | p. 18 |
Storage Duration | p. 19 |
Alignment | p. 20 |
Object Types | p. 21 |
Boolean Types | p. 21 |
Character Types | p. 22 |
Numerical types | p. 22 |
Void Types | p. 24 |
Function Types | p. 24 |
Derived Types | p. 25 |
Pointer Types | p. 25 |
Arrays | p. 26 |
Structures | p. 28 |
Unions | p. 29 |
Tags | p. 30 |
Type Qualifiers | p. 32 |
Const | p. 32 |
Volatile | p. 33 |
Restrict | p. 33 |
Exercises | p. 34 |
Summary | p. 34 |
Arithmetic Types | p. 35 |
Integers | p. 36 |
Padding and Precision | p. 36 |
The Header File | p. 36 |
Declaring Integers | p. 37 |
Unsigned Integers | p. 37 |
Signed Integers | p. 40 |
Integer Constants | p. 44 |
Floating-Point | p. 45 |
Floating-Point Types | p. 46 |
Floating-Point Arithmetic | p. 47 |
Floating-Point Values | p. 47 |
Floating-Point Constants | p. 49 |
Arithmetic Conversion | p. 49 |
Integer Conversion Rank | p. 50 |
Integer Promotions | p. 51 |
Usual Arithmetic Conversions | p. 52 |
An Example of Implicit Conversion | p. 53 |
Safe Conversions | p. 54 |
Summary | p. 55 |
Expressions and Operators | p. 57 |
Simple Assignment | p. 58 |
Evaluations | p. 59 |
Function Invocation | p. 60 |
Increment and Decrement Operators | p. 61 |
Operator Precedence and Associativity | p. 62 |
Order of Evaluation | p. 64 |
Unsequenced and Indeterminately Sequenced Evaluations | p. 65 |
Sequence Points | p. 66 |
Sizeof Operator | p. 66 |
Arithmetic Operators | p. 67 |
Unary + and - Operators | p. 67 |
Logical Negation Operator | p. 68 |
Multiplicative Operators | p. 68 |
Additive Operators | p. 69 |
Bitwise Operators | p. 69 |
Complement Operator | p. 70 |
Shift Operators | p. 70 |
Bitwise AND Operator | p. 72 |
Bitwise Exclusive OR Operator | p. 72 |
Bitwise Inclusive OR Operator | p. 73 |
Logical Operators | p. 73 |
Cast Operators | p. 75 |
Conditional Operator | p. 76 |
_Alignof Operator | p. 76 |
Relational Operators | p. 77 |
Compound Assignment Operators | p. 78 |
Comma Operator | p. 78 |
Pointer Arithmetic | p. 79 |
Summary | p. 80 |
Control Flow | p. 81 |
Expression Statements | p. 81 |
Compound Statements | p. 82 |
Selection Statements | p. 83 |
The if Statement | p. 83 |
The switch Statement | p. 86 |
Iteration Statements | p. 89 |
The while Statement | p. 89 |
The do…while Statement | p. 90 |
The for Statement | p. 91 |
Jump Statements | p. 93 |
The goto Statement | p. 93 |
The continue Statement | p. 94 |
The break Statement | p. 95 |
The return Statement | p. 96 |
Exercises | p. 97 |
Summary | p. 97 |
Dynamically Allocated Memory | p. 99 |
Storage Duration | p. 100 |
The Heap and Memory Managers | p. 100 |
When to Use Dynamically Allocated Memory | p. 101 |
Memory Management Functions | p. 101 |
The malloc Function | p. 102 |
The aligned_alloc Function | p. 104 |
The calloc Function | p. 105 |
The realloc Function | p. 105 |
The reallocarray Function | p. 107 |
The free Function | p. 108 |
Memory States | p. 109 |
Flexible Array Members | p. 110 |
Other Dynamically Allocated Storage | p. 111 |
The alloca Function | p. 111 |
Variable-Length Arrays | p. 112 |
Debugging Allocated Storage Problems | p. 115 |
Dmalloc | p. 116 |
Safety-Critical Systems | p. 118 |
Exercises | p. 118 |
Summary | p. 118 |
Characters and Strings | p. 119 |
Characters | p. 120 |
ASCII | p. 120 |
Unicode | p. 120 |
Source and Execution Character Sets | p. 122 |
Data Types | p. 122 |
Character Constants | p. 124 |
Escape Sequences | p. 125 |
Linux | p. 126 |
Windows | p. 126 |
Character Conversion | p. 128 |
Strings | p. 131 |
String Literals | p. 132 |
String-Handling Functions | p. 134 |
and | p. 135 |
Annex K Bounds-Checking Interfaces | p. 141 |
POSIX | p. 144 |
Microsoft | p. 145 |
Summary | p. 145 |
Input/Output | p. 147 |
Standard I/O Streams | p. 148 |
Stream Buffering | p. 148 |
Predefined Streams | p. 149 |
Stream Orientation | p. 150 |
Text and Binary Streams | p. 150 |
Opening and Creating Files | p. 151 |
The fopen Function | p. 151 |
The POSIX open Function | p. 153 |
Closing Files | p. 154 |
The fclose Function | p. 154 |
The POSIX close Function | p. 155 |
Reading and Writing Characters and Lines | p. 155 |
Stream Flushing | p. 157 |
Setting the Position in a File | p. 158 |
Removing and Renaming Files | p. 161 |
Using Temporary Files | p. 161 |
Reading Formatted Text Streams | p. 162 |
Reading to and Writing from Binary Streams | p. 165 |
Summary | p. 168 |
Preprocessor | p. 169 |
The Compilation Process | p. 170 |
File Inclusion | p. 171 |
Quoted and Angle Bracket Include Strings | p. 172 |
Conditional Inclusion | p. 172 |
Generating Errors | p. 173 |
Using Header Guards | p. 174 |
Macro Definitions | p. 175 |
Macro Replacement | p. 178 |
Type-Generic Macros | p. 180 |
Predefined Macros | p. 181 |
Summary | p. 183 |
Program Structure | p. 185 |
Principles of Componentization | p. 186 |
Coupling and Cohesion | p. 186 |
Code Reuse | p. 187 |
Data Abstractions | p. 187 |
Opaque Types | p. 188 |
Executables | p. 189 |
Linkage | p. 191 |
Structuring a Simple Program | p. 192 |
Building the Code | p. 196 |
Summary | p. 198 |
Debugging, Testing, and Analysis | p. 199 |
Assertions | p. 199 |
Static Assertions | p. 200 |
Runtime Assertions | p. 202 |
Compiler Settings and Flags | p. 203 |
GCC and Clang | p. 204 |
Visual C++ | p. 206 |
Debugging | p. 208 |
Unit Testing | p. 211 |
Static Analysis | p. 214 |
Dynamic Analysis | p. 216 |
AddressSanitizer | p. 217 |
Exercises | p. 221 |
Summary | p. 221 |
References | p. 223 |
Index | p. 227 |
Table of Contents provided by Ingram. All Rights Reserved. |