Preface | p. xiii |
Introduction to C | p. 1 |
Command Line Tools | p. 2 |
The gcc Compiler | p. 2 |
Useful Switches for the gcc Command (optional) | p. 3 |
The lint-related Utilities (optional) | p. 4 |
Editors and IDEs | p. 4 |
What is C? | p. 5 |
What is Special About C? | p. 5 |
Major Revisions to C | p. 6 |
A High-Level View of C Programs | p. 7 |
The Structure of C Programs | p. 7 |
Coding Guidelines | p. 7 |
Keywords in C | p. 8 |
A Hello World Program in C | p. 8 |
C Header Files and Libraries | p. 9 |
Valid Syntax for the main () Function | p. 9 |
C Program Syntax | p. 10 |
Compiling C Programs | p. 10 |
Variable Names in C | p. 12 |
Assignment Statements | p. 12 |
Indentation and Code Format | p. 13 |
The printf () Function | p. 14 |
Data Types in C | p. 15 |
The sizeof () Operator in C | p. 15 |
Operators in C | p. 16 |
Arithmetic Operators | p. 16 |
Increment/Decrement Operators | p. 17 |
Ternary Operator | p. 18 |
Calculating Ceiling and Floor Values | p. 19 |
Calculating Absolute Values | p. 20 |
Calculating Trigonometric Values in C | p. 21 |
Working with Different Bases in C | p. 21 |
Working with the char Type in C | p. 22 |
What are C Arrays? | p. 23 |
Adding the Numbers in an Array | p. 23 |
Summary | p. 24 |
Conditional Logic and Simple Tasks | p. 25 |
Comments in C Programs | p. 25 |
Simple Conditional Logic | p. 26 |
Conditional Logic with Logical Errors | p. 27 |
Arithmetic Operators and Conditional Logic | p. 28 |
Compound if-else Statements | p. 29 |
What is "Short Circuiting"? | p. 30 |
Ranking Numbers with if-else Statements | p. 31 |
Sequential if Statements | p. 32 |
Nested if-else Statements | p. 33 |
Scope of Variables in C | p. 34 |
Global Variables in C Programs | p. 34 |
Global Versus Local Variables | p. 34 |
Type Casting in C | p. 35 |
Integer Promotion | p. 36 |
The strcpy () and strncpy () Functions in C | p. 37 |
Strings and String-related Functions | p. 38 |
The strcpy () Function | p. 39 |
Handling User Input in C | p. 41 |
The get char () & put char () Functions: Single Character Functions | p. 41 |
The scanf () and printf () Functions: Multiple Characters | p. 41 |
C11 Compliance | p. 43 |
Checking for C11 Compliance | p. 44 |
What about C17 Compliance? | p. 45 |
The fgets () Function (C11 Compliant) | p. 45 |
The gets () Function (not C11 Compliant) | p. 46 |
Reading a Single Character from the Command Line | p. 47 |
Reading an Unformatted Line from the Command Line | p. 47 |
Reading a Formatted Line from the Command Line | p. 49 |
The Behavior of the scanf () Function (optional) | p. 50 |
Reading Multiple Strings from the Command Line | p. 51 |
User Input for Numeric Calculations | p. 52 |
Stdin, Stdout, and Stderr | p. 54 |
Summary | p. 54 |
Loops and Arrays | p. 55 |
Working with for Loops | p. 55 |
Working with Break and Continue in for Loops | p. 56 |
Checking for Leap Years | p. 57 |
Checking Alphabetic Types | p. 58 |
Counting Uppercase and Lowercase Characters | p. 59 |
Checking Character Types | p. 60 |
Working with Arrays | p. 61 |
Initializing Arrays | p. 62 |
Array Values | p. 62 |
C Functions and Arrays | p. 63 |
Multi-Dimensional Arrays | p. 63 |
Calculating the Transpose of a Square Matrix | p. 65 |
Linear Search in Arrays | p. 66 |
Reversing an Array of Numbers | p. 67 |
Finding the Maximum and Minimum in Arrays | p. 68 |
Deleting an Element from an Array | p. 69 |
Strings and for Loops | p. 70 |
Counting Words in a Line of Text | p. 72 |
Working with Nested for Loops | p. 73 |
Working with while Loops | p. 74 |
Reading an Entire Line from the Command Line | p. 74 |
The switch Statement | p. 75 |
Working with Arrays of Numbers | p. 76 |
Working with Arrays of Strings | p. 77 |
Using a while loop to Find the Divisors of a Number | p. 78 |
Using a while loop to Find Prime Numbers | p. 79 |
Summary | p. 80 |
Functions in C | p. 81 |
Working with Built-in Functions in C | p. 81 |
Pass by Reference versus Pass by Value | p. 82 |
Built-in Character Functions | p. 82 |
Converting Between Data Types | p. 83 |
Defining a Simple Custom Function | p. 83 |
Function Prototypes | p. 84 |
Function Parameters in C Functions | p. 84 |
C99 Syntax for User-Defined Functions in C | p. 85 |
K&R Style Function Definitions | p. 86 |
Converting Strings to Integers and Float Values | p. 87 |
Printing a String to a Buffer with sprintf () | p. 88 |
Buffer Manipulation Functions | p. 89 |
Passing a One-Dimensional Array as an Argument | p. 90 |
Finding a Character in a String | p. 91 |
Converting Strings to Decimal Values | p. 92 |
Display a List of Prime Numbers | p. 93 |
What is Recursion? | p. 95 |
Calculating Factorial Values | p. 95 |
Calculating Fibonacci Numbers via Recursion | p. 96 |
Calculating the Power of a Number via Recursion | p. 97 |
Calculating the Number of Digits of a Number via Recursion | p. 98 |
Calculating the Sum of the Digits of a Number via Recursion | p. 99 |
Calculating the GCD of Two Numbers via Recursion | p. 99 |
Calculating the LCM of Two Numbers via Recursion | p. 101 |
Summary | p. 102 |
Working with Pointers in C | p. 103 |
What are Pointers? | p. 103 |
Simple Examples of Pointers | p. 104 |
Const Pointers | p. 106 |
Pointers to Integer Variables | p. 106 |
Multiple Pointers and Integer Variables | p. 109 |
Pointers and Character Strings | p. 109 |
Displaying Substrings of a String | p. 111 |
Display Command Line Arguments in C | p. 112 |
Incrementing Pointers: Memory Location Versus Value | p. 113 |
Pointers and Arrays | p. 114 |
Pointers, Arrays, and Addresses | p. 116 |
Pointer Arithmetic | p. 117 |
Calculating the Transpose of a Square Matrix | p. 118 |
Pointers and Strings | p. 119 |
Pointers and Built-in String Manipulation Functions | p. 120 |
While Loops and Pointers to Strings | p. 121 |
Counting Vowels and Consonants in a Text String | p. 122 |
Finding a Word in a Text String in C | p. 124 |
Searching a Word in a Text String in C | p. 125 |
Concatenating Two Strings in C | p. 126 |
Summary | p. 127 |
Working with Pointers | p. 129 |
Comparing Two Strings in C | p. 129 |
Using strtok () to Tokenize a String | p. 131 |
Pointers, Strings, and Palindromes | p. 132 |
Pass by Reference Versus Value | p. 133 |
Pass an Array by Pointer | p. 135 |
A for Loop with Pointers to Numbers | p. 136 |
Pointers, Loops, and Divisors of a Number | p. 137 |
Pointers and Arrays of Numbers | p. 138 |
Array of Pointers | p. 139 |
Pointers and Functions | p. 140 |
Pointers and Arrays of Decimals | p. 141 |
"Reversing" an Array of Numbers | p. 142 |
Memory Allocation Functions in C | p. 144 |
The Built-in malloc () C Function | p. 144 |
Jagged Arrays | p. 145 |
User Input, Pointers, malloc (), and free () | p. 147 |
Heap versus Stack | p. 148 |
Uppercase and Lowercase Strings in C | p. 148 |
Reversing a String | p. 149 |
Finding Uppercase and Lowercase Letters | p. 150 |
Removing Whitespaces from a String | p. 152 |
Pointers, Strings, and Character Counts | p. 153 |
Pointers to Functions of Type Void | p. 156 |
Pointers to Non-Void Functions | p. 157 |
Function Pointers as Arguments | p. 158 |
Pointers to Pointers | p. 160 |
Summary | p. 161 |
Miscellaneous Topics | p. 163 |
Symbolic Constants | p. 163 |
Working with Macros in C | p. 164 |
Other Operators in C | p. 165 |
Bitwise Operators | p. 165 |
Logical Operators | p. 166 |
Comma Operator | p. 166 |
Cumulative Code Sample | p. 166 |
The Bubble Sort Algorithm | p. 168 |
What is a C struct? | p. 169 |
An Example of a C struct | p. 170 |
A Pointer to a C struct | p. 171 |
Nested C Structs | p. 172 |
An Array of C Structs | p. 173 |
The strftime () and strptime () Functions with Dates (optional) | p. 175 |
Singly Linked Lists in C (optional) | p. 177 |
Unions in C | p. 178 |
Combining a union and a struct in C | p. 179 |
Bitfields in C | p. 181 |
Display Environment Variables in C | p. 182 |
Set Environment Variables in C | p. 183 |
Storage Class Specifiers in C | p. 184 |
How Write Complex Code with Pointers | p. 185 |
Error Handling in C | p. 186 |
The errno Global Variable | p. 186 |
The perror () and strerror () Functions | p. 186 |
How to Exit from an Error | p. 187 |
System Calls in C (optional) | p. 188 |
Removing a File | p. 188 |
Listing the Files in a Directory | p. 189 |
Defining Custom Functions in Multiple Files (optional) | p. 190 |
Standard Header Files and Libraries | p. 192 |
Standard Header Files (Unix-like Systems) | p. 192 |
Commonly Used Header Files | p. 193 |
Standard Libraries | p. 193 |
Summary | p. 194 |
Appendix The make Utility | p. 195 |
What is the make Utility? | p. 195 |
What is in Makefile? | p. 196 |
Useful Unix Commands for Libraries | p. 196 |
Examples of the ar Command | p. 197 |
The ranlib Command | p. 197 |
The nm Command | p. 197 |
Some Simple Makefiles | p. 198 |
A Makefile for C Programs | p. 199 |
Big Make and Little Make | p. 200 |
A Makefile with Macros | p. 201 |
A Make file with Standard Targets | p. 202 |
Command Line Switches for Makefiles | p. 203 |
How do Makefiles Work? | p. 203 |
Multiple Source Files and the make Utility | p. 204 |
Macros for Multiple C Files | p. 206 |
Other Macros in Makefiles | p. 207 |
Automatic Variables | p. 208 |
Creating Multiple Executables in a Makefile | p. 208 |
Other Types of Targets in a Makefile | p. 209 |
Specifying Headers and Libraries in a Makefile | p. 210 |
Specifying Libraries | p. 211 |
Dummy Targets in a Makefile | p. 211 |
Including a Makefile in Another Makefile | p. 211 |
Creating a Library Archive from Object Files | p. 213 |
Creating an Archive Library in a Shell Script | p. 214 |
Summary | p. 214 |
Index | p. 215 |
Table of Contents provided by Ingram. All Rights Reserved. |