Book description
Improve your programming through a solid understanding of C pointers and memory management. With this practical book, you’ll learn how pointers provide the mechanism to dynamically manipulate memory, enhance support for data structures, and enable access to hardware. Author Richard Reese shows you how to use pointers with arrays, strings, structures, and functions, using memory models throughout the book.
Difficult to master, pointers provide C with much flexibility and power—yet few resources are dedicated to this data type. This comprehensive book has the information you need, whether you’re a beginner or an experienced C or C++ programmer or developer.
- Get an introduction to pointers, including the declaration of different pointer types
- Learn about dynamic memory allocation, de-allocation, and alternative memory management techniques
- Use techniques for passing or returning data to and from functions
- Understand the fundamental aspects of arrays as they relate to pointers
- Explore the basics of strings and how pointers are used to support them
- Examine why pointers can be the source of security problems, such as buffer overflow
- Learn several pointer techniques, such as the use of opaque pointers, bounded pointers and, the restrict keyword
Publisher resources
Table of contents
- Preface
-
1. Introduction
- Pointers and Memory
- Pointer Size and Types
- Pointer Operators
- Common Uses of Pointers
- Summary
- 2. Dynamic Memory Management in C
- 3. Pointers and Functions
-
4. Pointers and Arrays
- Quick Review of Arrays
- Pointer Notation and Arrays
- Using malloc to Create a One-Dimensional Array
- Using the realloc Function to Resize an Array
- Passing a One-Dimensional Array
- Using a One-Dimensional Array of Pointers
- Pointers and Multidimensional Arrays
- Passing a Multidimensional Array
- Dynamically Allocating a Two-Dimensional Array
- Jagged Arrays and Pointers
- Summary
- 5. Pointers and Strings
- 6. Pointers and Structures
-
7. Security Issues and the Improper Use of Pointers
- Pointer Declaration and Initialization
-
Pointer Usage Issues
- Test for NULL
- Misuse of the Dereference Operator
- Dangling Pointers
- Accessing Memory Outside the Bounds of an Array
- Calculating the Array Size Incorrectly
- Misusing the sizeof Operator
- Always Match Pointer Types
- Bounded Pointers
- String Security Issues
- Pointer Arithmetic and Structures
- Function Pointer Issues
- Memory Deallocation Issues
- Using Static Analysis Tools
- Summary
- 8. Odds and Ends
- Index
- About the Author
- Colophon
- Copyright
Product information
- Title: Understanding and Using C Pointers
- Author(s):
- Release date: May 2013
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9781449344184
You might also like
book
C++ Primer, Fifth Edition
Bestselling Programming Tutorial and Reference Completely Rewritten for the New C++11 Standard Fully updated and recast …
book
Learn C the Hard Way: A Clear & Direct Introduction To Modern C Programming
This is the Rough Cut version of the printed book. Need to learn C? Now you …
video
Programming in C - The Complete Course
A vast majority of modern programming languages and popular libraries are based on C, making C …
video
Learn C the Hard Way (Companion Videos)
These videos are companion files meant to be used with the book: Learn C the Hard …