Название: Intermediate C Programming, 2nd Edition Автор: Yung-Hsiang Lu, George K. Thiruvathukal Издательство: CRC Press Год: 2024 Страниц: 1079 Язык: английский Формат: pdf, epub Размер: 10.1 MB
Revised for a new second edition, 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.
This second edition provides expanded coverage of these topics with new material focused on software engineering, including version control and unit testing. The text 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.
There are hundreds of books about programming, many of them about C programming. Why do we write this book? Why should you spend time reading it? How is this book different from any other book? We write this book because we perceive a need for it. We think the approach in this book is better. We divide existing programming books into two types: introductory and advanced. Introductory books assume readers have no background in programming and explain the basic concepts, sometimes starting with the “Hello World!” program. These books explain language features step-by-step: keywords, data types, control structures, file operations, and so on. Every program in these books is short, at most 100 lines of code. Each short program can explain one new concept about the programming language. If we think of learning a computer language as learning a natural language like English, Chinese, French, or Korean, these books teach us how to write sentences and short paragraphs. The second type of book is written for people comfortable with programming. These books describe programs solving real problems, such as computer games or networks. The examples in these books are usually quite long, sometimes thousands of lines of code. The source code can be downloaded from the Internet. These books focus mostly on algorithms, not on how to write programs. Readers won't find “Hello World!” examples in these books. Returning to the natural language analogy, these books teach us how to write short novels, maybe a twenty-page story. It is difficult to jump from writing a paragraph to writing a novel.
To fill this need, we write this book for intermediate-level readers as a second book on programming. Very few books are written for intermediate-level readers. They know something about programming already and are not surprised when they see if or while. They know how to create functions and call functions. They can write short programs, perhaps dozens of lines of code. However, they are not ready to handle thousand-line programs. They make mistakes sometimes. Most books talk about how to write correct programs without much help with avoiding common mistakes. The readers are unfamiliar with many concepts and tools that can help them write better programs. These readers need a stepping stone to take them from being capable of writing short programs to writing real programs.
Most programming books talk about how to create correct programs. However, few books talk about common mistakes and why they are wrong. It is helpful to learn what is correct and also what is wrong. It is important to compare correct programs with incorrect programs. A careless mistake can make a program behave unexpectedly. Worse, the program may be correct in some scenarios and wrong in others. Such bugs (mistakes in computer programs are often called “bugs”) are difficult to find. This book explains some common mistakes so that readers understand how to prevent these mistakes. Debugging is ignored in most books. Few books mention the word “debugger” and readers simply do not know the existence of such tools. Learning how to use a debugger can save precious time.