|Published (Last):||22 June 2019|
|PDF File Size:||6.81 Mb|
|ePub File Size:||15.62 Mb|
|Price:||Free* [*Free Regsitration Required]|
You are on page 1of Search inside document K. But even C must change with the times. The need for a new edition of C Pro- gramming: A Modern Approach became apparent when the C99 standard was pub- lished. The second edition is fully up-to-date and has been improved in many other ways as well. Many of the C99 additions are of interest only to a specialized audience, but some of the new features will be of use to nearly all C programmers.
Appendix D im the first edition described all C89 standard library functions. In this edi- tion, the appendix covers all C89 and C99 library functions. Expanded coverage of GCC. GCC has some significant advantages, including high quality, low i. New coverage of abstract data types. When I wrote the first edition, bit architectures and the DOS operating system were still rele- vant to many readers, but such is not the case today.
The rise of Linux and other versions of UNIX has dictated a stronger focus on that family of operat- ing systems, although aspects of Windows and the Mac OS operating system that affect C programmers are mentioned as well. More exercises and programming projects. The first edition of this book con- tained exercises. This edition has nearly , to be exact , divided into two groups: exercises and programming projects. Solutions to selected exercises and programming projects. The most frequent request I received from readers of the first edition was to provide answers to the exercises.
Password-protected instructor website. Faculty may contact me at chook knking. The changes are extensive and painstaking: every sentence has been checked and—if necessary—rewritten.
Only one chapter the last one is entirely new, but many chapters have additional sections. In a few cases, existing sections have been renumbered.
Many C books are too concise for the average reader. Others are badly written or just plain dull. My experience in teaching C underscores the importance of presenting the features of C gradually, Tuse a spiral approach, in which difficult topics are introduced briefly, then revisited one or more times later in the book with details added each time. Pacing is deliberate, with each chapter building gradually on what has come before.
All pro- grams are designed to be portable to a wide variety of platforms. Instead of treating C as the only programming language worth knowing, I treat it as one of many useful languages. I stress making programs readable, maintainable, reliable, and portable, and I put special emphasis on information hiding.
These features, although handy for the kind of systems programming originally done in C, are not as relevant now that C is used for a great variety of applications. Instead of introducing them in the early chapters, as many C books do, I postpone them until Chapter Although readers with experience in a variety of languages may be satisfied with a brief expla- nation and a couple of examples, readers with less experience need more.
Curious readers with a fair bit of programming experience may wish to delve into these questions imme- diately; others should definitely skip them on a first reading, Warning: These questions often refer to topics covered in later chapters. C is famous for its traps; docu- menting them all is a hopeless—if not impossible—task. This change reflects recommended practice and is compatible with C99, which requires an explicit return type for each function.
Updates, correc- tions, and news about the book can also be found at this site. Chapters build on the material in the earlier chapters. The topics become a little harder in these chapters, which provide in- Preface — xxvii depth coverage of pointers, strings, the preprocessor, structures, unions, enu- merations, and low-level features of C. In addition, two chapters 15 and 19 offer guidance on program design. Chapters focus on the C library, a large col- lection of functions that come with every compiler.
These chapters are m likely to be used as reference material, although portions are suitable for lec- tures, u Reference. Appendix A gives a complete list of C operators. An annotated bibliogra- phy points the reader toward other sources of information, A full-blown course on C should cover Chapters in sequence, with topics from Chapters added as needed.
A shorter course can omit the following topics without losing continuity: Section 8. Errors, Lack of? Inevitably, however, any book of this size contains a few errors. If you spot one, please contact me at chook knking. Fred got the second edition underway and Aaron stepped in with brisk efficiency to bring it to completion. Bermudez, Lisa J. Brown, Steven C. Maccabe, Carolyn Rosner, and Patrick Terry. T received many useful comments from readers of the first edition; I thank everyone who took the time to write.
Students and colleagues at Georgia State Uni- versity also provided valuable feedback. Ed Bullwinkel and his wife Nancy were kind enough to read much of the manuscript. My wife, Susan Cole, was a pillar of strength as always.
Our cats, Dennis, Pounce, and Tex, were also instrumental in the completion of the book. Pounce and Tex were happy to contribute the occasional catfight to help keep me awake while I was working late at night.
Perlis, whose epigrams appear at the beginning of each chapter. I had the privilege of studying briefly under Alan at Yale in the mids. Pointer Variables Declaring Pointer Variables Pointer Assignment Like other operating systems of the time, UNIX was written in assembly lan- guage.
Programs written in assembly language are usually painful to debug and hard to enhance; UNIX was no exception. By , it became apparent that B was not well-suited to the PDP, so Ritchie began to develop an extended version of B.
The switch to C provided an important benefit: portability. Standardization C continued to evolve during the s, especially between and It was during this period that the first book on C appeared. C compilers became available on a variety of machines: running under different operating systems. The need for a thorough, precise, and up-to-date description of the lan- guage soon became apparent. The development of a U. After many revisions, the stan- dard was completed in and formally approved in December as ANSI standard X3.
This ver- sion of the language is usually referred to as C89 or C90, to distinguish it from the 1. Appendix B lists the major differences between C99 and C I think it is, for several reasons. Programmers who learn one of these languages first often fail to master basic features that were inherited from C. Second, there are a lot of older C programs around; you may find yourself needing to read and main tain this code, Third, C is still widely used for developing new software, especially in situations where memory or processing power is limited or where the simplicity of Cis desired.
It emphasizes data abstraction, information hiding, and other principles that play a large role in object-oriented programming. Many of the features of C can be found in the other C-based languages as well, 4 Chapter 1 Introducing C 4.
To serve as a suitable language for systems pro- gramming, C provides access to machine-level concepts bytes and addresses, for example that other programming languages try to hide. C provides a more limited set of features than many languages. Because C was intended for applications where assembly language had tradi- tionally been used, it was crucial that C programs could run quickly and in limited amounts of memory.
When a program must run on computers ranging from PCs to supercomputers, it is often written in C. Although C was originally designed for systems programming, it has no inherent restrictions that limit it to this arena. C is now used for appli- cations of all kinds, from embedded systems to commercial data processing. Moreover, C imposes very few restrictions on the use of its features; opera- tions that would be illegal in other languages are often permitted in C.
For example, C allows a character to be added to an integer value or, for that mat- ter, a floating-point number.
This flexibility can make programming easier, although it may allow some bugs to slip through. To make matters worse, C contains a number of pitfalls for the unwary. These fea- tures can be combined in a great variety of ways, many of which—although obvious to the original author of a program—can be hard for others to under- stand. Another problem is the terse nature of C programs.
C was designed at a time when interactive communication with computers was tedious at best. As a result, C was purposefully Kept terse to minimize the time required to enter and edit programs. C, unfortunately, lacks such features. In fact, it works for any number of queens between four and For more winning programs, visit wwwiocce.
C programmers are pro- lific tool builders and users. One of the most famous C tools is named 1 int. Lint, which is traditionally provided with UNIX, can subject a program to a more extensive error analysis than most C compilers. Con- sequently, using a good debugger is practically mandatory for C programmers.
C Programming: A Modern Approach, 2nd Edition
C Programming (a Modern Approach – 2nd Edition) – K. N. King [pdf]