Teach Your Students How to Program Well
Intermediate C Programming provides a stepping-stone for intermediate-level students to go from writing short programs to writing real programs well. It shows students how to identify and eliminate bugs, write clean code, share code with others, and use standard Linux-based tools, such as ddd and valgrind.
The text covers numerous concepts and tools that will help your students write better programs. It enhances their programming skills by explaining programming concepts and comparing common mistakes with correct programs. It also discusses how to use debuggers and the strategies for debugging as well as studies the connection between programming and discrete mathematics.
Yung-Hsiang Lu is an associate professor in the School of Electrical and Computer Engineering at Purdue University. He is an ACM Distinguished Scientist and ACM Distinguished Speaker. He received a Ph.D. from the Department of Electrical Engineering at Stanford University.
Computer Storage Memory and File Program Execution Compile Redirecting Output Stack Memory Values and Addresses Stack The Call Stack Visibility Exercises Answers Examine the Call Stack with DDD Prevent, Detect, and Remove Bugs Developing Software ? ? Coding Common Mistakes Post-Execution and Interactive Debugging Separate Testing Code from Production Code Pointer Scope The Swap Function Pointers The Swap Function Revisited Type Errors Array and Pointer Type Rules Pointer Arithmetics Exercises Answers Writing and Testing Programs Distinct Array Elements Test Using Makefile Invalid Memory Access Use valgrind to Check Memory Access Errors Test Coverage Limit Core Size Program with Infinite Loops Strings Array of Characters String Functions in C Understanding argv Counting Substrings Programming Problems and Debugging Implement String Functions Debugging Heap Memory Create Array with malloc The Stack and the Heap Function That Return a Heap Address Two-Dimensional Arrays in C Pointers and Arguments Programming Problems Sorting an Array Sort Using qsrot Reading and Writing Files Passing a File Name via argv Reading from Files Writing to Files Reading and Writing Strings Programming Problems Sorting a File of Integers Counting the Occurrences of Characters Counting the Occurrences of a Word How to Comment Code Recursion Recursion Selecting Balls with Restrictions One-Way Streets The Tower of Hanoi Calculating Integer Partitions Recursive C Functions Select Balls with Restrictions One-Way Streets The Tower of Hanoi Integer Partition Factorial Fibonacci Numbers Performance Profiling Using gprof Integer Partition Stack and Heap Memory Trace Recursion Function Calls Generating Partitions with Restrictions Programming Problems Binary Search Quick Sort Permutations and Combinations Stack Sort Tracing a Recursive Function A Recursive Function with a Mistake Structure Programmer-Defined Data Types Struct and Object Passing Objects as Arguments Objects and Pointers Constructors and Destructors Structures within Structures Binary Files and Objects Programming Problems Sorting a Person Database Packing Decimal Digits Binary File and Pointer Linked Lists Expandable Types Linked Lists Inserting Data Searching a Linked List Deleting from a Linked List Printing a Linked List Destroying a Linked List Programming Problems Queues Sorting Numbers Sparse Arrays Reversing a Linked List Binary Search Trees Binary Search Tree Inserting Data into a Binary Search Tree Searching a Binary Search Tree Printing a Binary Search Tree Deleting from a Binary Search Tree Destroying a Binary Search Tree main Makefile Counting the Different Shapes of a Binary Tree Parallel Programming Using Threads Parallel Programming Multi-Tasking POSIX Thread Subset Sum Interleaving the Execution of Threads Thread Synchronization Amdahl's Law Applications Finding the Exit of a Maze Maze File Format Reading the Maze File The Maze Structure An Escape Strategy Implementing the Strategy Image Processing Structure for Image Processing Images Huffman Compression Example Encoding Decoding Appendix A: Linux Appendix B: Version Control Appendix C: Integrated Development Environments (IDE) Index