| |
| |
| |
Getting Started | |
| |
| |
| |
What to Expect from C | |
| |
| |
| |
Fundamentals-Reserved Words, Identifiers, the Character Set | |
| |
| |
| |
Subprograms or Functions in C | |
| |
| |
| |
An Introduction to Output in C | |
| |
| |
| |
Input and Output with Variables | |
| |
| |
| |
Arithmetic Operations | |
| |
| |
| |
Introduction to Functions and Structured Programming in C | |
| |
| |
Language Elements Introduced in This Chapter: A Review | |
| |
| |
Things to RememberExercises and Programming Problems | |
| |
| |
| |
Gaining Control | |
| |
| |
| |
Expressions and Statements | |
| |
| |
| |
Blocks and Compound Statements | |
| |
| |
| |
The if and if-else Statements | |
| |
| |
| |
Relational Operators and Expressions | |
| |
| |
| |
The while Loop | |
| |
| |
| |
Logical Operators and Expressions | |
| |
| |
| |
The for Loop | |
| |
| |
| |
Making C Readable-Programming Style | |
| |
| |
Language Elements Introduced in This Chapter: A Review | |
| |
| |
Things to Remember | |
| |
| |
Exercises and Programming Problems | |
| |
| |
| |
Basic Data Types | |
| |
| |
| |
Introduction to Scalar Types in C | |
| |
| |
| |
Integers and Different Integer Bases | |
| |
| |
| |
The Integer Types | |
| |
| |
| |
The size of() Operator | |
| |
| |
| |
Character Variables | |
| |
| |
| |
Unsigned Types | |
| |
| |
| |
ANSI C and Integer Types | |
| |
| |
| |
If There's Time or Need: Bit Operations on the Integer Types | |
| |
| |
| |
Floating Point Types | |
| |
| |
| |
Types of Expressions and Automatic Conversions | |
| |
| |
| |
Forced Type Conversions | |
| |
| |
Language Elements Introduced in This Chapter: A Review | |
| |
| |
Things to Remember | |
| |
| |
Exercises and Programming Problems | |
| |
| |
| |
Arrays and Pointers | |
| |
| |
| |
One Dimensional Arrays | |
| |
| |
| |
Initialization of Arrays | |
| |
| |
| |
Arrays as Parameters to Functions | |
| |
| |
| |
Getting Started with Pointers | |
| |
| |
| |
Pointer Arithmetic | |
| |
| |
| |
Dereferencing a Pointer Variable | |
| |
| |
| |
An Array as a Pointer | |
| |
| |
| |
Passing Parameters to Functions | |
| |
| |
| |
Searching and Sorting Arrays | |
| |
| |
| |
Pointers and Dynamic Memory Allocation | |
| |
| |
Language Elements Introduced in This Chapter: A Review | |
| |
| |
Things to Remember | |
| |
| |
Exercises and Programming Problems | |
| |
| |
| |
Strings | |
| |
| |
| |
Introduction to Strings | |
| |
| |
| |
Variable Strings | |
| |
| |
| |
Input and Output of Strings | |
| |
| |
| |
The Common String Library Functions | |
| |
| |
| |
Examples with strlen() and strchr() | |
| |
| |
| |
More Functions in the C String Library | |
| |
| |
| |
Two Versions of strcat() | |
| |
| |
Language Elements Introduced in This Chapter: A Review | |
| |
| |
Things to Remember | |
| |
| |
Exercises and Programming Problems | |
| |
| |
| |
Keeping Control | |
| |
| |
| |
Introduction | |
| |
| |
| |
The do-while Statement | |
| |
| |
| |
The switch Statement | |
| |
| |
| |
Altering the Flow of Control | |
| |
| |
| |
Getting Out Gracefully | |
| |
| |
| |
If There's Time or Need: Using Recursion | |
| |
| |
Language Elements Introduced in This Chapter: A Review | |
| |
| |
Things to Remember | |
| |
| |
Exercises and Programming Problems | |
| |
| |
| |
Structuring the Data | |
| |
| |
| |
Introduction to Structures | |
| |
| |
| |
Operations on Structures | |
| |
| |
| |
Using Structures with Arrays and Pointers | |
| |
| |
| |
Bit Fields | |
| |
| |
| |
Enumerated Types | |
| |
| |
| |
UnionsLanguage Elements Introduced in This Chapter: A Review | |
| |
| |
Things to Remember | |
| |
| |
Exercises and Programming Problems | |
| |
| |
| |
Intra-program Communication | |
| |
| |
| |
Introduction | |
| |
| |
| |
Automatic versus Static Variables | |
| |
| |
| |
Global versus Local Variables | |
| |
| |
| |
Modules and External Variables | |
| |
| |
| |
Typedefs | |
| |
| |
| |
Function Definitions | |