Computing Reviews
Today's Issue Hot Topics Search Browse Recommended My Account Log In
Review Help
Search
Practical C
Zambon G., Apress, New York, NY, 2016. 469 pp. Type: Book (978-1-484217-68-9)
Date Reviewed: Jun 5 2017

The C programming language remains one of the principal languages for developing operating systems and many applications, especially in the sciences and engineering. This book is not a textbook. Rather, it is an extended personal essay by the author on how he creates C programs in different application areas, only one of which can be considered a traditional mathematical application. Likewise, because it is not a textbook, it lacks exercises and problems at the end of each chapter.

The reader is presumed to have command of C syntax and experience in writing demanding C programs. The emphasis is more on style, design, and implementation than on syntactical conundrums. There are 14 chapters and two appendices in the book. The two appendices are a list of acronyms and abbreviations and a summary of SQL language features used in chapter 12.

The first chapter is called “Introduction,” but it is really an essay on programming style to support the readability and maintainability of code. The second chapter deals with language features and traps that a programmer can fall into such as scope and life of variables, functions calls, preprocessor macros, Booleans, character strings, and especially numerical data types, which are discussed at length. The discussion of floating point numbers is extensive.

The first data structure discussed in the book is the binary tree in the third chapter. Leading up to the binary tree, the author again discusses programming style by urging robust construction of iterative loops. He eschews indefinite looping with breaks. This topic segues into a discussion of iteration versus recursion. Although recursion is elegant and is taught and used in virtually every programming course, it has higher overhead than iteration. He selected the binary tree as the initial data structure because of the extensive range of applications of the tree. He then develops an extended example in which he uses the traversal of the binary tree in ASCII art. The study of data structures continues into the fourth chapter in which lists, stacks, and queues are the focus. He begins with the list and first implements it in an array and then as a linked list using pointers. He takes the same approach with the stack and queue, first as an array, then as a special type of linked list. He shows how macros can be used to handle these data structures as linked lists.

The power of macros is further shown in chapter 5 on exception handling in which macros are used to implement throwing and catching of exceptions. Chapter 6 is devoted to character string handling. He presents an entire library that goes beyond the functions in “string.h” to handle allocating and releasing memory. Chapter 7 on dynamic arrays builds on the ideas developed for strings in chapter 6. The string library treats strings as dynamically allocated arrays of characters. These ideas are generalized in chapter 7.

Searching and sorting are treated in chapters 8 and 9, respectively. The chapter on searches begins with the built-in C function for making comparisons and then discusses the following cases: unordered data (linear search), ordered data (binary search), and binary trees for ordered data. The binary search example for ordered data includes making insertions and deletions on the dataset. The binary tree example is treated recursively and iteratively. Producing balanced trees from an unbalanced tree concludes the binary tree example. The standard sorting algorithms are all reviewed in chapter 9: insertion sort, shell sort, bubble sort, and quick sort. He includes measuring their performance. He also discusses his own version of quick sort that differs from that in the C library.

Chapter 10 on numerical integration is the only standard chapter on a standard mathematical topic. He treats one and two variables. His single variable examples include tabular functions, trapezoidal rule, Simpson’s rule, and Newton-Cotes formulae. His discussion includes stopping criteria and singularities, evaluation of a maximum and minimum in an interval, and the Monte Carlo method. For two variables, his examples integrate over an area that may be divided in different ways: square, triangle, hexagon, and trapezoid/prism.

C is used often to program embedded systems because the C language has been ported to many different processor architectures. This is the topic of chapter 11. It returns to the question of numerical representation, bit operations, and endianness discussed in the second chapter. Applications considered in this chapter are naked boards, real-time operating systems, signals and interrupts, and concurrency.

Chapter 12 shows how C can be used to interface with a database system that supports SQL. There are two database systems considered in this chapter: MySQL and SQLite. Chapter 13 is an extended example of embedding a web server in C. Mongoose is used as the web server module. He starts with a discussion of the behavior and functionality of web servers as distinct from the client’s browser. The purpose of the chapter is to show how to use PHP or JSP functionality for data validation on the web server in a C program on the client side that will connect with the browser. Computational work is shifted from the web server side to the client side. The author points out that the applicability of this software structure will be the largest in the “Internet of Things” where the software, including the web server, can be on the user’s handheld device. In developing his example, he shows how he rewrote a portion of Mongoose to make it work satisfactorily and to generate clearer error messages.

The last chapter is an example of creating a MathSearch game that is like a WordSearch game. Instead of words that can appear horizontally, vertically, or diagonally in WordSearch, the objects in MathSearch are triples of numbers that represent a legitimate arithmetic operation, like 68/17 = 4. He presents the entire development cycle: specifications, design, and code implementation. The puzzles created can be of different sizes, can support the arithmetic operations, can be made in multiples, and can be displayed (with solutions) in both HTML and as JPEG files (using Magic Wand, part of GIMP).

The example files can be found at the publisher’s website by following the URL in the book. The author developed all of his examples on an Ubuntu Linux computer. The first nine chapters cover many, if not all, of the topics covered in a good C programming language course sequence, but they do so as a practitioner of C may think about them rather than as academic exercises. Readers can choose among the applications in the remaining five chapters according to their personal and professional needs. The application chapters do not depend on each other.

Reviewer:  Anthony J. Duben Review #: CR145328 (1708-0496)
Bookmark and Share
  Featured Reviewer  
 
Language Constructs and Features (D.3.3 )
 
 
C (D.3.2 ... )
 
 
Reference (A.2 )
 
Would you recommend this review?
yes
no
Other reviews under "Language Constructs and Features": Date
A stub generator for multilanguage RPC in heterogeneous environments
Gibbons P. IEEE Transactions on Software Engineering 13(1): 77-87, 1987. Type: Article
Aug 1 1987
Essentials of programming languages
Friedman D. (ed), Haynes C., Wand M., MIT Press, Cambridge, MA, 1992. Type: Book (9780262061452)
Feb 1 1994
Symbolic computing with Lisp
Cameron R., Dixon A., Prentice-Hall, Inc., Upper Saddle River, NJ, 1992. Type: Book (9780138778460)
Apr 1 1994
more...

E-Mail This Printer-Friendly
Send Your Comments
Contact Us
Reproduction in whole or in part without permission is prohibited.   Copyright 1999-2024 ThinkLoud®
Terms of Use
| Privacy Policy