0%

Book Description

The professional programmer’s Deitel® guide to procedural programming in C through 130 working code examples

Written for programmers with a background in high-level language programming, this book applies the Deitel signature live-code approach to teaching the C language and the C Standard Library. The book presents the concepts in the context of fully tested programs, complete with syntax shading, code highlighting, code walkthroughs and program outputs. The book features approximately 5,000 lines of proven C code and hundreds of savvy tips that will help you build robust applications.

Start with an introduction to C, then rapidly move on to more advanced topics, including building custom data structures, the Standard Library, select features of the new C11 standard such as multithreading to help you write high-performance applications for today’s multicore systems, and secure C programming sections that show you how to write software that is more robust and less vulnerable. You’ll enjoy the Deitels’ classic treatment of procedural programming. When you’re finished, you’ll have everything you need to start building industrial-strength C applications.

Practical, example-rich coverage of:

  • C programming fundamentals

  • Compiling and debugging with GNU gcc and gdb, and Visual C++®

  • Key new C11 standard features: Type generic expressions, anonymous structures and unions, memory alignment, enhanced Unicode® support, _Static_assert, quick_exit and at_quick_exit, _Noreturn function specifier, C11 headers

  • C11 multithreading for enhanced performance on today’s multicore systems

  • Secure C Programming sections

  • Data structures, searching and sorting

  • Order of evaluation issues, preprocessor

  • Designated initializers, compound literals, bool type, complex numbers, variable-length arrays, restricted pointers, type generic math, inline functions, and more.

  • Visit www.deitel.com

  • For information on Deitel’s Dive Into® Series programming training courses delivered at organizations worldwide visit www.deitel.com/training or write to [email protected]

  • Download code examples

  • To receive updates for this book, subscribe to the free DEITEL® BUZZ ONLINE e-mail newsletter at www.deitel.com/newsletter/subscribe.html

  • Join the Deitel social networking communities on Facebook® at facebook.com/DeitelFan, Twitter® @deitel, LinkedIn® at bit.ly/DeitelLinkedIn and Google+™ at gplus.to/Deitel

  • Table of Contents

    1. About This eBook
    2. Title Page
    3. Copyright Page
    4. Deitel® Series Page
      1. Deitel® Developer Series
      2. LiveLessons Video Learning Products
      3. Simply Series
      4. CourseSmart Web Books
      5. How To Program Series
    5. Dedication Page
    6. Contents
    7. Preface
      1. Features
      2. A Note About Secure C Programming
      3. Teaching Approach
      4. Software Used in C for Programmers with an Introduction to C11
      5. C Fundamentals: Parts I and II LiveLessons Video Training Product
      6. Acknowledgments
      7. About the Authors
      8. Corporate Training from Deitel & Associates, Inc.
    8. 1. Introduction
      1. 1.1. Introduction
      2. 1.2. The C Programming Language
      3. 1.3. C Standard Library
      4. 1.4. C++ and Other C-Based Languages
      5. 1.5. Typical C Program Development Environment
      6. 1.6. Test-Driving a C Application in Windows, Linux and Mac OS X
      7. 1.7. Operating Systems
    9. 2. Introduction to C Programming
      1. 2.1. Introduction
      2. 2.2. A Simple C Program: Printing a Line of Text
      3. 2.3. Another Simple C Program: Adding Two Integers
      4. 2.4. Arithmetic in C
      5. 2.5. Decision Making: Equality and Relational Operators
      6. 2.6. Secure C Programming
    10. 3. Control Statements: Part I
      1. 3.1. Introduction
      2. 3.2. Control Structures
      3. 3.3. The if Selection Statement
      4. 3.4. The if...else Selection Statement
      5. 3.5. The while Repetition Statement
      6. 3.6. Class Average with Counter-Controlled Repetition
      7. 3.7. Class Average with Sentinel-Controlled Repetition
      8. 3.8. Nested Control Statements
      9. 3.9. Assignment Operators
      10. 3.10. Increment and Decrement Operators
      11. 3.11. Secure C Programming
    11. 4. Control Statements: Part II
      1. 4.1. Introduction
      2. 4.2. Repetition Essentials
      3. 4.3. Counter-Controlled Repetition
      4. 4.4. for Repetition Statement
      5. 4.5. for Statement: Notes and Observations
      6. 4.6. Examples Using the for Statement
      7. 4.7. switch Multiple-Selection Statement
      8. 4.8. do...while Repetition Statement
      9. 4.9. break and continue Statements
      10. 4.10. Logical Operators
      11. 4.11. Confusing Equality (==) and Assignment (=) Operators
      12. 4.12. Secure C Programming
    12. 5. Functions
      1. 5.1. Introduction
      2. 5.2. Program Modules in C
      3. 5.3. Math Library Functions
      4. 5.4. Functions
      5. 5.5. Function Definitions
      6. 5.6. Function Prototypes: A Deeper Look
      7. 5.7. Function Call Stack and Stack Frames
      8. 5.8. Headers
      9. 5.9. Passing Arguments By Value and By Reference
      10. 5.10. Random Number Generation
      11. 5.11. Example: A Game of Chance
      12. 5.12. Storage Classes
      13. 5.13. Scope Rules
      14. 5.14. Recursion
      15. 5.15. Example Using Recursion: Fibonacci Series
      16. 5.16. Recursion vs. Iteration
      17. 5.17. Secure C Programming
    13. 6. Arrays
      1. 6.1. Introduction
      2. 6.2. Arrays
      3. 6.3. Defining Arrays
      4. 6.4. Array Examples
      5. 6.5. Passing Arrays to Functions
      6. 6.6. Sorting Arrays
      7. 6.7. Case Study: Computing Mean, Median and Mode Using Arrays
      8. 6.8. Searching Arrays
      9. 6.9. Multidimensional Arrays
      10. 6.10. Variable-Length Arrays
      11. 6.11. Secure C Programming
    14. 7. Pointers
      1. 7.1. Introduction
      2. 7.2. Pointer Variable Definitions and Initialization
      3. 7.3. Pointer Operators
      4. 7.4. Passing Arguments to Functions by Reference
      5. 7.5. Using the const Qualifier with Pointers
      6. 7.6. Bubble Sort Using Pass-by-Reference
      7. 7.7. sizeof Operator
      8. 7.8. Pointer Expressions and Pointer Arithmetic
      9. 7.9. Relationship between Pointers and Arrays
      10. 7.10. Arrays of Pointers
      11. 7.11. Case Study: Card Shuffling and Dealing Simulation
      12. 7.12. Pointers to Functions
      13. 7.13. Secure C Programming
    15. 8. Characters and Strings
      1. 8.1. Introduction
      2. 8.2. Fundamentals of Strings and Characters
      3. 8.3. Character-Handling Library
      4. 8.4. String-Conversion Functions
      5. 8.5. Standard Input/Output Library Functions
      6. 8.6. String-Manipulation Functions of the String-Handling Library
      7. 8.7. Comparison Functions of the String-Handling Library
      8. 8.8. Search Functions of the String-Handling Library
      9. 8.9. Memory Functions of the String-Handling Library
      10. 8.10. Other Functions of the String-Handling Library
      11. 8.11. Secure C Programming
    16. 9. Formatted Input/Output
      1. 9.1. Introduction
      2. 9.2. Streams
      3. 9.3. Formatting Output with printf
      4. 9.4. Printing Integers
      5. 9.5. Printing Floating-Point Numbers
      6. 9.6. Printing Strings and Characters
      7. 9.7. Other Conversion Specifiers
      8. 9.8. Printing with Field Widths and Precision
      9. 9.9. Using Flags in the printf Format Control String
      10. 9.10. Printing Literals and Escape Sequences
      11. 9.11. Reading Formatted Input with scanf
      12. 9.12. Secure C Programming
    17. 10. Structures, Unions, Bit Manipulation and Enumerations
      1. 10.1. Introduction
      2. 10.2. Structure Definitions
      3. 10.3. Initializing Structures
      4. 10.4. Accessing Structure Members
      5. 10.5. Using Structures with Functions
      6. 10.6. typedef
      7. 10.7. Example: High-Performance Card Shuffling and Dealing Simulation
      8. 10.8. unions
      9. 10.9. Bitwise Operators
      10. 10.10. Bit Fields
      11. 10.11. Enumeration Constants
      12. 10.12. Secure C Programming
    18. 11. File Processing
      1. 11.1. Introduction
      2. 11.2. Files and Streams
      3. 11.3. Creating a Sequential-Access File
      4. 11.4. Reading Data from a Sequential-Access File
      5. 11.5. Random-Access Files
      6. 11.6. Creating a Random-Access File
      7. 11.7. Writing Data Randomly to a Random-Access File
      8. 11.8. Reading Data from a Random-Access File
      9. 11.9. Case Study: Transaction-Processing Program
      10. 11.10. Secure C Programming
    19. 12. Data Structures
      1. 12.1. Introduction
      2. 12.2. Self-Referential Structures
      3. 12.3. Dynamic Memory Allocation
      4. 12.4. Linked Lists
      5. 12.5. Stacks
      6. 12.6. Queues
      7. 12.7. Trees
      8. 12.8. Secure C Programming
    20. 13. Preprocessor
      1. 13.1. Introduction
      2. 13.2. #include Preprocessor Directive
      3. 13.3. #define Preprocessor Directive: Symbolic Constants
      4. 13.4. #define Preprocessor Directive: Macros
      5. 13.5. Conditional Compilation
      6. 13.6. #error and #pragma Preprocessor Directives
      7. 13.7. # and ## Operators
      8. 13.8. Line Numbers
      9. 13.9. Predefined Symbolic Constants
      10. 13.10. Assertions
      11. 13.11. Secure C Programming
    21. 14. Other Topics
      1. 14.1. Introduction
      2. 14.2. Redirecting I/O
      3. 14.3. Variable-Length Argument Lists
      4. 14.4. Using Command-Line Arguments
      5. 14.5. Notes on Compiling Multiple-Source-File Programs
      6. 14.6. Program Termination with exit and atexit
      7. 14.7. Suffixes for Integer and Floating-Point Literals
      8. 14.8. Signal Handling
      9. 14.9. Dynamic Memory Allocation: Functions calloc and realloc
      10. 14.10. Unconditional Branching with goto
    22. A. Operator Precedence Chart
    23. B. ASCII Character Set
    24. C. Number Systems
      1. C.1. Introduction
      2. C.2. Abbreviating Binary Numbers as Octal and Hexadecimal Numbers
      3. C.3. Converting Octal and Hexadecimal Numbers to Binary Numbers
      4. C.4. Converting from Binary, Octal or Hexadecimal to Decimal
      5. C.5. Converting from Decimal to Binary, Octal or Hexadecimal
      6. C.6. Negative Binary Numbers: Two’s Complement Notation
    25. D. Sorting: A Deeper Look
      1. D.1. Introduction
      2. D.2. Big O Notation
      3. D.3. Selection Sort
      4. D.4. Insertion Sort
      5. D.5. Merge Sort
    26. E. Additional Features of the C Standard
      1. E.1. Introduction
      2. E.2. Support for C99
      3. E.3. C99 Headers
      4. E.4. Mixing Declarations and Executable Code
      5. E.5. Declaring a Variable in a for Statement Header
      6. E.6. Designated Initializers and Compound Literals
      7. E.7. Type bool
      8. E.8. Implicit int in Function Declarations
      9. E.9. Complex Numbers
      10. E.10. Variable-Length Arrays
      11. E.11. Additions to the Preprocessor
      12. E.12. Other C99 Features
      13. E.13. New Features in the C11 Standard
      14. E.14. Web Resources
    27. F. Using the Visual Studio Debugger
      1. F.1. Introduction
      2. F.2. Breakpoints and the Continue Command
      3. F.3. Locals and Watch Windows
      4. F.4. Controlling Execution Using the Step Into, Step Over, Step Out and Continue Commands
      5. F.5. Autos Window
    28. G. Using the GNU Debugger
      1. G.1. Introduction
      2. G.2. Breakpoints and the run, stop, continue and print Commands
      3. G.3. print and set Commands
      4. G.4. Controlling Execution Using the step, finish and next Commands
      5. G.5. watch Command
    29. Index
    3.137.167.195