Table of Contents
Understanding and Using C Pointers - Core Techniques for Memory Management
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
Q&A with Richard Reese, author of "Understanding and Using C Pointers"
Q. Why is your book timely?
A. The C language continues to be a popular and widely used language. In addition, there are millions of lines of C code being maintained. Pointers are central to C and a solid understanding of them is important in crafting reliable and secure software. Understanding C pointers has always been important but they have not always been adequately covered. Their widespread usage in new and old applications begs a complete and comprehensive coverage.
Q. What do you hope that readers of your book will walk away with?
A. I hope that the experienced developer will be able to fill any holes in their understanding of C pointers. I hope that the less experienced developers will become more proficient and confident in their application of pointers.
Q. Can you give us a few tips on using pointers?
- Be careful when using pointers to void. If you cast a pointer to a pointer to void there is nothing preventing you from casting it to a different pointer type.
- When using function pointers the C programmer must be careful to ensure it is used properly because C does not check to see if the correct pointer parameters are passed.
- New code development should use the restrict keyword with most pointer declarations. This will enable better code optimization. Modifying existing code may not be worth the effort.
- C Compilers do not always do a good job at reporting C alias-related warnings. They can sometimes miss C aliases and may sometimes report alias problems where they don't exist. It is ultimately up to the C programmer to identify alias conditions.
- Improperly aligned C pointers can result in an abnormal program termination or retrieval of bad data. In addition, slower pointer access is possible if the C compiler is required to generate additional machine code to compensate for the improper alignment.
About the Author
Richard Reese has worked in the industry and academics for the past 29 years. For 10 years he provided software development support at Lockheed and at one point developed a C based network application. He was a contract instructor providing software training to industry for 5 years. Richard is currently an Associate Professor at Tarleton State University in Stephenville, Texas
Product Details
- Publisher: O'Reilly Media; 1st edition (May 28, 2013)
- Publication date: May 1, 2013
- Paperback: 226 pages
- Time to complete: 6h
Attribution
An attribution usually includes the title, author, publisher, and ISBN or ASIN. For example: “Understanding and Using C Pointers by Richard Reese (O’Reilly). Copyright 2013 Richard Reese, Ph.D. 978-1-449-34418-4.”
Fair Use Sources
C Language: C Fundamentals, C Inventor - C Language Designer: Dennis Ritchie in 1972; C Standards: ANSI X3J11 (ANSI C); ISO/IEC JTC 1 (Joint Technical Committee 1) / SC 22 (Subcommittee 22) / WG 14 (Working Group 14) (ISO C); C Keywords, C Pointers, C Data Structures - C Algorithms, C Syntax, C Memory Management, C Recursion, C on Android, C on Linux, C on macOS, C on Windows, C Installation, C Containerization, C Configuration, C Compiler, C IDEs (CLion), C Development Tools, C DevOps - C SRE, C Data Science - C DataOps, C Machine Learning, C Deep Learning, C Concurrency, C History, C Bibliography, Manning C Programming Series, C Glossary, C Topics, C Courses, C Standard Library, C Libraries, C Frameworks, C Research, C GitHub, Written in C, C Popularity, C Awesome List, C Versions. (navbar_c)
© 1994 - 2024 Cloud Monk Losang Jinpa or Fair Use. Disclaimers
SYI LU SENG E MU CHYWE YE. NAN. WEI LA YE. WEI LA YE. SA WA HE.