Book description
C Primer Plus is a carefully tested, well-crafted, and complete tutorial on a subject core to programmers and developers. This computer science classic teaches principles of programming, including structured code and top-down design.
Author and educator Stephen Prata has created an introduction to C that is instructive, clear, and insightful. Fundamental programming concepts are explained along with details of the C language. Many short, practical examples illustrate just one or two concepts at a time, encouraging readers to master new topics by immediately putting them to use.
Review questions and programming exercises at the end of each chapter bring out the most critical pieces of information and help readers understand and digest the most difficult concepts. A friendly and easy-to-use self-study guide, this book is appropriate for serious students of programming, as well as developers proficient in other languages with a desire to better understand the fundamentals of this core language.
The sixth edition of this book has been updated and expanded to cover the latest developments in C as well as to take a detailed look at the new C11 standard. In C Primer Plus you’ll find depth, breadth, and a variety of teaching techniques and tools to enhance your learning:
- Complete, integrated discussion of both C language fundamentals and additional features
- Clear guidance about when and why to use different parts of the language
- Hands-on learning with concise and simple examples that develop your understanding of a concept or two at a time
- Hundreds of practical sample programs
- Review questions and programming exercises at the end of each chapter to test your understanding
- Coverage of generic C to give you the greatest flexibility
Table of contents
- About This eBook
- Title Page
- Copyright Page
- Developer’s Library
- Contents at a Glance
- Dedication
- About the Author
- Acknowledgments
- We Want to Hear from You!
- Reader Services
- Preface
- 1 Getting Ready
-
2 Introducing C
- A Simple Example of C
- The Example Explained
- The Structure of a Simple Program
- Tips on Making Your Programs Readable
- Taking Another Step in Using C
- While You’re at It—Multiple Functions
- Introducing Debugging
- Keywords and Reserved Identifiers
- Key Concepts
- Summary
- Review Questions
- Programming Exercises
- 3 Data and C
- 4 Character Strings and Formatted Input/Output
- 5 Operators, Expressions, and Statements
-
6 C Control Statements: Looping
- Revisiting the while Loop
- The while Statement
- Which Is Bigger: Using Relational Operators and Expressions
- Indefinite Loops and Counting Loops
- The for Loop
- More Assignment Operators: +=, -=, *=, /=, %=
- The Comma Operator
- An Exit-Condition Loop: do while
- Which Loop?
- Nested Loops
- Introducing Arrays
- A Loop Example Using a Function Return Value
- Key Concepts
- Summary
- Review Questions
- Programming Exercises
- 7 C Control Statements: Branching and Jumps
- 8 Character Input/Output and Input Validation
-
9 Functions
-
Reviewing Functions
- Creating and Using a Simple Function
- Analyzing the Program
- Function Arguments
- Defining a Function with an Argument: Formal Parameters
- Prototyping a Function with Arguments
- Calling a Function with an Argument: Actual Arguments
- The Black-Box Viewpoint
- Returning a Value from a Function with return
- Function Types
- ANSI C Function Prototyping
- Recursion
- Compiling Programs with Two or More Source Code Files
- Finding Addresses: The & Operator
- Altering Variables in the Calling Function
- Pointers: A First Look
- Key Concepts
- Summary
- Review Questions
- Programming Exercises
-
Reviewing Functions
- 10 Arrays and Pointers
- 11 Character Strings and String Functions
- 12 Storage Classes, Linkage, and Memory Management
-
13 File Input/Output
- Communicating with Files
- Standard I/O
- A Simple-Minded File-Condensing Program
- File I/O: fprintf(), fscanf(), fgets(), and fputs()
- Adventures in Random Access: fseek() and ftell()
- Behind the Scenes with Standard I/O
-
Other Standard I/O Functions
- The int ungetc(int c, FILE *fp) Function
- The int fflush() Function
- The int setvbuf() Function
- Binary I/O: fread() and fwrite()
- The size_t fwrite() Function
- The size_t fread() Function
- The int feof(FILE *fp) and int ferror(FILE *fp) Functions
- An fread() and fwrite() Example
- Random Access with Binary I/O
- Key Concepts
- Summary
- Review Questions
- Programming Exercises
-
14 Structures and Other Data Forms
- Sample Problem: Creating an Inventory of Books
- Setting Up the Structure Declaration
- Defining a Structure Variable
- Arrays of Structures
- Nested Structures
- Pointers to Structures
-
Telling Functions About Structures
- Passing Structure Members
- Using the Structure Address
- Passing a Structure as an Argument
- More on Structure Features
- Structures or Pointer to Structures?
- Character Arrays or Character Pointers in a Structure
- Structure, Pointers, and malloc()
- Compound Literals and Structures (C99)
- Flexible Array Members (C99)
- Anonymous Structures (C11)
- Functions Using an Array of Structures
- Saving the Structure Contents in a File
- Structures: What Next?
- Unions: A Quick Look
- Enumerated Types
- typedef: A Quick Look
- Fancy Declarations
- Functions and Pointers
- Key Concepts
- Summary
- Review Questions
- Programming Exercises
- 15 Bit Fiddling
-
16 The C Preprocessor and the C Library
- First Steps in Translating a Program
- Manifest Constants: #define
- Using Arguments with #define
- Macro or Function?
- File Inclusion: #include
- Other Directives
- Inline Functions (C99)
- _Noreturn Functions (C11)
- The C Library
- The Math Library
- The General Utilities Library
- The Assert Library
- memcpy() and memmove() from the string.h Library
- Variable Arguments: stdarg.h
- Key Concepts
- Summary
- Review Questions
- Programming Exercises
- 17 Advanced Data Representation
-
A Answers to the Review Questions
- Answers to Review Questions for Chapter 1
- Answers to Review Questions for Chapter 2
- Answers to Review Questions for Chapter 3
- Answers to Review Questions for Chapter 4
- Answers to Review Questions for Chapter 5
- Answers to Review Questions for Chapter 6
- Answers to Review Questions for Chapter 7
- Answers to Review Questions for Chapter 8
- Answers to Review Questions for Chapter 9
- Answers to Review Questions for Chapter 10
- Answers to Review Questions for Chapter 11
- Answers to Review Questions for Chapter 12
- Answers to Review Questions for Chapter 13
- Answers to Review Questions for Chapter 14
- Answers to Review Questions for Chapter 15
- Answers to Review Questions for Chapter 16
- Answers to Review Questions for Chapter 17
-
B Reference Section
- Section I: Additional Reading
- Section II: C Operators
- Section III: Basic Types and Storage Classes
- Section IV: Expressions, Statements, and Program Flow
-
Section V: The Standard ANSI C Library with C99 and C11 Additions
- Diagnostics: assert.h
- Complex Numbers: complex.h (C99)
- Character Handling: ctype.h
- Error Reporting: errno.h
- Floating-Point Environment: fenv.h (C99)
- Floating-point Characteristics: float.h
- Format Conversion of Integer Types: inttypes.h (C99)
- Alternative Spellings: iso646.h
- Localization: locale.h
- Math Library: math.h
- Non-Local Jumps: setjmp.h
- Signal Handling: signal.h
- Alignment: stdalign.h (C11)
- Variable Arguments: stdarg.h
- Atomics Support: stdatomic.h (C11)
- Boolean Support: stdbool.h (C99)
- Common Definitions: stddef.h
- Integer Types: stdint.h
- Standard I/O Library: stdio.h
- General Utilities: stdlib.h
- _Noreturn: stdnoreturn.h
- String Handling: string.h
- Type-Generic Math: tgmath.h (C99)
- Threads: threads.h (C11)
- Date and Time: time.h
- Unicode Utilities: uchar.h (C11)
- Extended Multibyte and Wide-Character Utilities: wchar.h (C99)
- Wide Character Classification and Mapping Utilities: wctype.h (C99)
- Section VI: Extended Integer Types
- Section VII: Expanded Character Support
- Section VIII: C99/C11 Numeric Computational Enhancements
- Section IX: Differences Between C and C++
- Index
Product information
- Title: C Primer Plus, Sixth Edition
- Author(s):
- Release date: November 2013
- Publisher(s): Addison-Wesley Professional
- ISBN: 9780133432398
You might also like
book
C How to Program, Fifth Edition
The Deitels' groundbreaking How to Program series offers unparalleled breadth and depth of object-oriented programming concepts …
book
Programming in C, Fourth Edition
will teach you how to write programs in the C programming language. Whether you’re a novice …
book
C Programming Language, 2nd Edition
This book is meant to help the reader learn how to program in C. It is …
book
Learn C Programming - Second Edition
Get started with writing simple programs in C while learning core programming concepts Key Features Learn …