Cover
Copyright
Contents at a Glance
Contents
About the Author
Introduction
1: Welcome to C
Programs, Software, and Operating System
Machine Language and Assembly Language
Procedural Languages
Object-Oriented Languages
Terminology in Computers
Compiled and Interpreted Languages
Compilation
Interpretation
Your First C Program
Salient Features of C
Implicit Type Conversion
Explicit Type Conversion
2: Control Statements
Selection Statements
Iteration Statements
Jump Statements
2-1. Sum 1 to N Numbers
Problem
Solution
The Code
How It Works
2-2. Compute the Factorial of a Number
Problem
Solution
The Code
How It Works
2-3. Generate a Fibonacci Sequence
Problem
Solution
The Code
How It Works
2-4. Determine Whether a Given Number Is Prime
Problem
Solution
The Code
How It Works
2-5. Compute the Sine Function
Problem
Solution
The Code
How It Works
2-6. Compute the Cosine Function
Problem
Solution
The Code
How It Works
2-7. Compute the Roots of Quadratic Equation
Problem
Solution
The Code
How It Works
2-8. Compute the Reverse of an Integer
Problem
Solution
The Code
How It Works
2-9. Print a Geometrical Pattern Using Nested Loops
Problem
Solution
The Code
How It Works
2-10. Generate a Table of Future Value Interest Factors
Problem
Solution
The Code
How It Works
3: Functions and Arrays
3-1. Determine the Value of Pi
Problem
Solution
The Code
How It Works
3-2. Pick the Prime Numbers from a List of Numbers
Problem
Solution
The Code
How It Works
3-3. Sum Numbers Using Recursion
Problem
Solution
The Code
How It Works
3-4. Compute the Fibonacci Sequence Using Recursion
Problem
Solution
The Code
How It Works
3-5. Compute the Factorial of a Number Using Recursion
Problem
Solution
The Code
How It Works
3-6. Search the Largest Element in an Array of Integers
Problem
Solution
The Code
How It Works
3-7. Solve the Classic Problem of the Towers of Hanoi
Solution
The Code
How It Works
3-8. Solve the Eight Queens Problem
Problem
Solution
How It Works
3-9. Compute Permutations and Combinations of a Given Set of Objects
Problem
Solution
The Code
How It Works
3-10. Perform the Summation of Two Matrices
Problem
Solution
The Code
How It Works
3-11. Compute the Transpose of a Matrix
Problem
Solution
The Code
How It Works
3-12. Compute the Product of Matrices
Problem
Solution
The Code
How It Works
4: Pointers and Arrays
4-1. Retrieve Data from an Array with the int Type Data
Problem
Solution
The Code
How It Works
4-2. Retrieve Data from an Array Using the Array Name
Problem
Solution
The Code
How It Works
4-3. Retrieve Data from an Array with char and double Type Data
Problem
Solution
The Code
How It Works
4-4. Access the Out-of-Bounds Array Elements
Problem
Solution
The Code
How It Works
4-5. Store Strings
Problem
Solution
The Code
How It Works
4-6. Store Strings Without Initialization
Problem
Solution
The Code
How It Works
4-7. Store Strings in an Interactive Session
Problem
Solution
The Code
How It Works
4-8. Retrieve the Addresses of Elements in a Two-Dimensional Array
Problem
Solution
The Code
How It Works
4-9. Retrieve the Base Addresses of Rows in a Two-Dimensional Array
Problem
Solution
The Code
How It Works
4-10. Retrieve Data from a Two-Dimensional Array
Problem
Solution
The Code
How It Works
4-11. Retrieve Data from a Two-Dimensional Array Using an Array Name
Problem
Solution
The Code
How It Works
4-12. Retrieve Data from an Array Using an Array of Pointers
Problem
Solution
The Code
How It Works
4-13. Swap Strings Physically
Problem
Solution
The Code
How It Works
4-14. Swap Strings Logically
Problem
Solution
The Code
How It Works
4-15. Store Strings Interactively
Problem
Solution
The Code
How It Works
4-16. Pass Arguments to a Program from the Command Line
Problem
Solution
The Code
How It Works
4-17. Retrieve Stored Strings Using a Pointer to a Pointer
Problem
Solution
The Code
How It Works
5: Functions and Structures with Pointers
5-1. Pass Arguments by Reference to a Function
Problem
Solution
The Code
How It Works
5-2. Display Data Stored in Nested Structures
Problem
Solution
The Code
How It Works
Dot Operator
Arrow Operator
5-3. Build a Structure Using a Function
Problem
Solution
The Code
How It Works
5-4. Modify the Data in a Structure by Passing It to a Function
Problem
Solution
The Code
How It Works
5-5. Modify the Data in a Structure by Passing a Pointer-to-Structure to a Function
Problem
Solution
The Code
How It Works
5-6. Store and Retrieve Data Using an Array of Structures
Problem
Solution
The Code
How It Works
5-7. Store and Retrieve Data Using an Array of Structures in Interactive Mode
Problem
Solution
The Code
How It Works
5-8. Invoke a Function Using a Pointer-to-Function
Problem
Solution
The Code
How It Works
5-9. Implement a Text-Based Menu System
Problem
Solution
The Code
How It Works
6: Data Files
6-1. Read a Text File Character by Character
Problem
Solution
The Code
How It Works
6-2. Handle Errors When File Opening Fails
Problem
Solution
The Code
How It Works
6-3. Write to a Text File in Batch Mode
Problem
Solution
The Code
How It Works
6-4. Write to a Text File in Interactive Mode
Problem
Solution
The Code
How It Works
6-5. Read a Text File String by String
Problem
Solution
The Code
How It Works
6-6. Write to a Text File Character by Character
Problem
Solution
The Code
How It Works
6-7. Write Integers to a Text File
Problem
Solution
The Code
How It Works
6-8. Write Structures to a Text File
Problem
Solution
The Code
How It Works
6-9. Read Integers Stored in a Text File
Problem
Solution
The Code
How It Works
6-10. Read Structures Stored in a Text File
Problem
Solution
The Code
How It Works
6-11. Write Integers to a Binary File
Problem
Solution
The Code
How It Works
6-12. Write Structures to a Binary File
Problem
Solution
The Code
How It Works
6-13. Read Integers Written to a Binary File
Problem
Solution
The Code
How It Works
6-14. Read Structures Written to a Binary File
Problem
Solution
The Code
How It Works
6-15. Rename a File
Problem
Solution
The Code
How It Works
6-16. Delete a File
Problem
Solution
The Code
How It Works
6-17. Copy a Text File
Problem
Solution
The Code
How It Works
6-18. Copy a Binary File
Problem
Solution
The Code
How It Works
6-19. Write to a File and Then Read from That File
Problem
Solution
The Code
How It Works
6-20. Position a Text File to a Desired Character
Problem
Solution
The Code
How It Works
6-21. Read from the Device File Keyboard
Problem
Solution
The Code
How It Works
6-22. Write Text to the Device File Monitor
Problem
Solution
The Code
How It Works
6-23. Read Text from the Device File Keyboard and Write It to the Device File Monitor
Problem
Solution
The Code
How It Works
7: Self-Referential Structures
7-1. Generate Lists of Numbers in an Interactive Manner
Problem
Solution
The Code
How It Works
7-2. Create a Linked List Using Anonymous Variables
Problem
Solution
The Code
How It Works
7-3. Delete a Component from a Linked List
Problem
Solution
The Code
How It Works
7-4. Insert a Component into a Linked List
Problem
Solution
The Code
How It Works
7-5. Create a Linked List in an Interactive Session
Problem
Solution
The Code
How It Works
7-6. Process a Linear Linked List
Problem
Solution
The Code
How It Works
7-7. Create a Linear Linked List with Forward and Backward Traversing
Problem
Solution
The Code
How It Works
8: Stacks and Queues
8-1. Implement a Stack as an Array
Problem
Solution
The Code
How It Works
8-2. Implement a Stack as a Linked List
Problem
Solution
The Code
How It Works
8-3. Convert an Infix Expression to a Postfix Expression
Problem
Solution
The Code
How It Works
8-4. Convert an Infix Expression to a Prefix Expression
Problem
Solution
The Code
How It Works
8-5. Implement a Circular Queue as an Array
Problem
Solution
The Code
How It Works
9: Searching and Sorting
9-1. Find a Data Element Using a Linear Search
Problem
Solution
The Code
How It Works
9-2. Find a Data Element Using a Binary Search
Problem
Solution
The Code
How It Works
9-3. Sort a Given List of Numbers Using a Bubble Sort
Problem
Solution
The Code
How It Works
9-4. Sort a Given List of Numbers Using an Insertion Sort
Problem
Solution
The Code
How It Works
9-5. Sort a Given List of Numbers Using a Selection Sort
Problem
Solution
The Code
How It Works
9-6. Sort a Given List of Numbers Using a Merge Sort
Problem
Solution
The Code
How It Works
9-7. Sort a Given List of Numbers Using a Shell Sort
Problem
Solution
The Code
How It Works
9-8. Sort a Given List of Numbers Using a Quick Sort
Problem
Solution
The Code
How It Works
10: Cryptographic Systems
10-1. Use the Reverse Cipher Method
Problem
Solution
The Code
How It Works
10-2. Use the Caesar Cipher Method
Problem
Solution
The Code
How It Works
10-3. Use the Transposition Cipher Method
Problem
Solution
The Code
How It Works
10-4. Use the Multiplicative Cipher Method
Problem
Solution
The Code
How It Works
10-5. Use the Affine Cipher Method
Problem
Solution
The Code
How It Works
10-6. Use the Simple Substitution Cipher Method
Problem
Solution
The Code
How It Works
10-7. Use the Vigenère Cipher Method
Problem
Solution
The Code
How It Works
10-8. Use the One-Time Pad Cipher Method
Problem
Solution
The Code
How It Works
10-9. Use the RSA Cipher Method
Problem
Solution
The Code
How It Works
11: Numerical Methods
11-1. To Find the Roots of an Equation Using the Bisection Method
Problem
Solution
The Code
How It Works
11-2. To Find the Roots of an Equation Using the Regula Falsi Method
Problem
Solution
The Code
How It Works
11-3. To Find the Roots of an Equation Using Muller's Method
Problem
Solution
The Code
How It Works
11-4. To Find the Roots of an Equation Using the Newton Raphson Method
Problem
Solution
The Code
How It Works
11-5. To Construct the New Data Points Using Newton's Forward Method of Interpolation
Problem
Solution
The Code
How It Works
11-6. To Construct the New Data Points Using Newton's Backward Method of Interpolation
Problem
Solution
The Code
How It Works
11-7. To Construct the New Data Points Using Gauss's Forward Method of Interpolation
Problem
Solution
The Code
How It Works
11-8. To Construct the New Data Points Using Gauss's Backward Method of Interpolation
Problem
Solution
The Code
How It Works
11-9. To Construct the New Data Points Using Stirling's Method of Interpolation
Problem
Solution
The Code
How It Works
11-10. To Construct the New Data Points Using Bessel's Method of Interpolation
Problem
Solution
The Code
How It Works
11-11. To Construct the New Data Points Using Laplace Everett's Method of Interpolation
Problem
Solution
The Code
How It Works
11-12. To Construct the New Data Points Using Lagrange's Method of Interpolation
Problem
Solution
The Code
How It Works
11-13. To Compute the Value of Integration Using Trapezoidal Method of Numerical Integration
Problem
Solution
The Code
How It Works
11-14. To Compute the Value of Integration Using Simpson's 3/8th Method of Numerical Integration
Problem
Solution
The Code
How It Works
11-15. To Compute the Value of Integration Using Simpson's 1/3rd Method of Numerical Integration
Problem
Solution
The Code
How It Works
11-16. To Solve a Differential Equation Using Modified Euler's Method
Problem
Solution
The Code
How It Works
11-17. To Solve a Differential Equation Using Runge Kutta Method
Problem
Solution
The Code
How It Works
Appendix A: Reference Tables
Appendix B: Library Functions
Character Testing and Processing Functions
String Processing Functions
Mathematical Functions
Utility Functions
Appendix C: C Idioms
Appendix D: Glossary of Terms
Index