Intermediate C Programming  book cover
1st Edition

Intermediate C Programming

ISBN 9781498711630
Published June 16, 2015 by CRC Press
500 Pages 123 B/W Illustrations

FREE Standard Shipping
USD $99.95

Prices & shipping based on shipping country


Book Description

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.

Table of Contents

Computer Storage Memory and File
Program Execution
Redirecting Output

Stack Memory
Values and Addresses
The Call Stack
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

The Swap Function
The Swap Function Revisited
Type Errors
Array and Pointer
Type Rules
Pointer Arithmetics

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

Array of Characters
String Functions in C
Understanding argv
Counting Substrings

Programming Problems and Debugging
Implement String Functions

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

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
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

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
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 
Counting the Different Shapes of a Binary Tree

Parallel Programming Using Threads
Parallel Programming
POSIX Thread
Subset Sum
Interleaving the Execution of Threads
Thread Synchronization
Amdahl’s Law

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

Appendix A: Linux
Appendix B: Version Control
Appendix C: Integrated Development Environments (IDE)


View More



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.


"Two features are notable. First, a crucial element of the book, elaborated early and in great detail, is the description of the program calling stack. This is an excellent pedagogical approach: a thorough understanding of how the calling stack is built and used goes a long way in ensuring that the programmer has a firm grasp of the design process, and it also plays a crucial role in tracing the location of errors. And second, many topics are accompanied by discussions of potential pitfalls and remedial strategies. …quite beneficial to novice programmers, the intended audience. It could also be used for professional development in class or by the independent reader."
—Edgar R. Chavez, in Computing Reviews

"… an excellent entryway into practical software development practices that will enable my beginning and even advanced students to be more productive in their day-to-day work by avoiding typical mistakes and by writing cleaner code … I wished I had this book some 20 years ago … the hands-on examples … are eye opening. I recommend this book to anyone who needs to write software beyond the tinkering level."
—From the Foreword by Gerhard Klimeck, Reilly Director of the Center for Predictive Materials and Devices and the Network for Computational Nanotechnology and Professor of Electrical and Computer Engineering, Purdue University; Fellow of the IOP, APS, and IEEE

"Intermediate C Programming bridges that critical gap between beginner and expert with clear examples in key areas. This book covers important concepts we use every day in industry when developing and debugging code."
—Harald Smit, Software Manager

"Higher order cognition occurs when one can analyze disparate parts of problems and issues or perform complicated operations. But advanced, critical thinking requires an assessment of how negative consequences can be avoided. In computer programming education, the leap between beginner-level recognition of syntax and artful, efficient language authoring occurs only when a student can regularly identify and predict likely errors in authored code. Intermediate C Programming provides essential lessons and practice in error analysis. By prioritizing debugging into each lesson, the author compels learners to consider the consequences of coding choices, one block at a time."
—David B. Nelson, Ph.D., Associate Director, Center for Instructional Excellence, Purdue University

"This well-written book provides the necessary tools and practical skills to turn students into seasoned programmers. It not only teaches students how to write good programs, but, more uniquely, also teaches them how to avoid writing bad programs. The inclusion of Linux operations and Versioning control as well as the coverage of applications and IDE build students’ confidence in taking control over large-scale software developments. At the end of this learning journey, students will possess the skills for helping others to debug their programs, an important step for building a new generation of programmers who are able to help one another in software development."
—Siau Cheng Khoo, Ph.D., National University of Singapore

"This book is unique in that it covers the C programming language from a bottom-up perspective, which is rare in programming books. Instead of starting with the high-level concepts, which easily get dry and uninspiring for students, the book begins with practical problems and progressively introduces the C concepts necessary to solve those problems. This means that students immediately understand how the language works from a very practical and pragmatic perspective."
—Niklas Elmqvist, Ph.D., Associate Professor and Program Director, Master of Science in Human–Computer Interaction, University of Maryland