چه کسانی این کتاب را می‌خوانند

دانشجوعلاقه‌مند یادگیری
کتابخوان حرفه‌ایلذت مطالعه
نویسندهالهام‌گیری

Understanding and Using C Pointers: Core techniques for memory management

Richard M. Reese

قیمت نهایی

۴۴٬۰۰۰ تومان۴۹٬۰۰۰ تومان۱۰٪ تخفیف
  • تخفیف زمان‌دار−۵٬۰۰۰ تومان

۵٬۰۰۰ تومان صرفه‌جویی نسبت به قیمت اصلی

نسخه اصلی و اورجینال

بلافاصله پس از خرید، فایل کتاب روی دستگاه شما آمادهٔ دانلود است.

تحویل فوری
پرداخت امن
ضمانت فایل
پشتیبانی

مشخصات کتاب

نویسنده
Richard M. Reese
سال انتشار
۲۰۱۳
فرمت
PDF
زبان
انگلیسی
حجم فایل
۷٫۷ مگابایت
شابک
9781449344184، 9781449344559، 9781449344566، 9781492013549، 9781492013556، 9788324682928، 1449344186، 1449344550، 1449344569، 1492013544، 1492013552، 8324682929

دربارهٔ کتاب

"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; and learn several pointer techniques, such as the use of opaque pointers, bounded pointers, and the restrict keyword."--Back cover Copyright 4 Table of Contents 5 Preface 11 Why This Book Is Different 11 The Approach 11 Audience 12 Organization 12 Summary 14 Conventions Used in This Book 14 Using Code Examples 15 Safari庐 Books Online 15 How to Contact Us 16 Chapter聽1.聽Introduction 17 Pointers and Memory 18 Why You Should Become Proficient with Pointers 19 Declaring Pointers 21 How to Read a Declaration 23 Address of Operator 24 Displaying Pointer Values 25 Dereferencing a Pointer Using the Indirection Operator 27 Pointers to Functions 27 The Concept of Null 27 Pointer Size and Types 31 Memory Models 32 Predefined Pointer-Related Types 32 Pointer Operators 36 Pointer Arithmetic 36 Comparing Pointers 41 Common Uses of Pointers 41 Multiple Levels of Indirection 41 Constants and Pointers 43 Summary 48 Chapter聽2.聽Dynamic Memory Management in C 49 Dynamic Memory Allocation 50 Memory Leaks 53 Dynamic Memory Allocation Functions 55 Using the malloc Function 55 Using the calloc Function 59 Using the realloc Function 60 The alloca Function and Variable Length Arrays 62 Deallocating Memory Using the free Function 63 Assigning NULL to a Freed Pointer 64 Double Free 64 The Heap and System Memory 66 Freeing Memory upon Program Termination 66 Dangling Pointers 67 Dangling Pointer Examples 67 Dealing with Dangling Pointers 69 Debug Version Support for Detecting Memory Leaks 70 Dynamic Memory Allocation Technologies 70 Garbage Collection in C 71 Resource Acquisition Is Initialization 71 Using Exception Handlers 72 Summary 72 Chapter聽3.聽Pointers and Functions 73 Program Stack and Heap 74 Program Stack 74 Organization of a Stack Frame 75 Passing and Returning by Pointer 77 Passing Data Using a Pointer 78 Passing Data by Value 78 Passing a Pointer to a Constant 79 Returning a Pointer 80 Pointers to Local Data 82 Passing Null Pointers 83 Passing a Pointer to a Pointer 84 Function Pointers 87 Declaring Function Pointers 88 Using a Function Pointer 89 Passing Function Pointers 90 Returning Function Pointers 91 Using an Array of Function Pointers 92 Comparing Function Pointers 93 Casting Function Pointers 93 Summary 94 Chapter聽4.聽Pointers and Arrays 95 Quick Review of Arrays 96 One-Dimensional Arrays 96 Two-Dimensional Arrays 97 Multidimensional Arrays 98 Pointer Notation and Arrays 99 Differences Between Arrays and Pointers 101 Using malloc to Create a One-Dimensional Array 102 Using the realloc Function to Resize an Array 103 Passing a One-Dimensional Array 106 Using Array Notation 106 Using Pointer Notation 107 Using a One-Dimensional Array of Pointers 108 Pointers and Multidimensional Arrays 110 Passing a Multidimensional Array 112 Dynamically Allocating a Two-Dimensional Array 115 Allocating Potentially Noncontiguous Memory 116 Allocating Contiguous Memory 116 Jagged Arrays and Pointers 118 Summary 121 Chapter聽5.聽Pointers and Strings 123 String Fundamentals 123 String Declaration 124 The String Literal Pool 125 String Initialization 126 Standard String Operations 130 Comparing Strings 131 Copying Strings 132 Concatenating Strings 134 Passing Strings 137 Passing a Simple String 137 Passing a Pointer to a Constant char 139 Passing a String to Be Initialized 139 Passing Arguments to an Application 141 Returning Strings 142 Returning the Address of a Literal 142 Returning the Address of Dynamically Allocated Memory 144 Function Pointers and Strings 146 Summary 148 Chapter聽6.聽Pointers and Structures 149 Introduction 149 How Memory Is Allocated for a Structure 151 Structure Deallocation Issues 152 Avoiding malloc/free Overhead 155 Using Pointers to Support Data Structures 157 Single-Linked List 158 Using Pointers to Support a Queue 165 Using Pointers to Support a Stack 168 Using Pointers to Support a Tree 170 Summary 174 Chapter聽7.聽Security Issues and the Improper Use of Pointers 175 Pointer Declaration and Initialization 176 Improper Pointer Declaration 176 Failure to Initialize a Pointer Before It Is Used 177 Dealing with Uninitialized Pointers 178 Pointer Usage Issues 178 Test for NULL 179 Misuse of the Dereference Operator 179 Dangling Pointers 180 Accessing Memory Outside the Bounds of an Array 180 Calculating the Array Size Incorrectly 181 Misusing the sizeof Operator 182 Always Match Pointer Types 182 Bounded Pointers 183 String Security Issues 184 Pointer Arithmetic and Structures 185 Function Pointer Issues 186 Memory Deallocation Issues 188 Double Free 188 Clearing Sensitive Data 189 Using Static Analysis Tools 189 Summary 190 Chapter聽8.聽Odds and Ends 191 Casting Pointers 192 Accessing a Special Purpose Address 193 Accessing a Port 194 Accessing Memory using DMA 195 Determining the Endianness of a Machine 196 Aliasing, Strict Aliasing, and the restrict Keyword 196 Using a Union to Represent a Value in Multiple Ways 198 Strict Aliasing 199 Using the restrict Keyword 200 Threads and Pointers 201 Sharing Pointers Between Threads 202 Using Function Pointers to Support Callbacks 204 Object-Oriented Techniques 206 Creating and Using an Opaque Pointer 206 Polymorphism in C 210 Summary 215 Index 217 About the Author 225 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 typesLearn about dynamic memory allocation, de-allocation, and alternative memory management techniquesUse techniques for passing or returning data to and from functionsUnderstand the fundamental aspects of arrays as they relate to pointersExplore the basics of strings and how pointers are used to support themExamine why pointers can be the source of security problems, such as buffer overflowLearn several pointer techniques, such as the use of opaque pointers, bounded pointers and, the restrict keyword Je?li chcesz b?yskawicznie opanowa? programowanie w j?zyku C, si?gnij po t? ksi??k?! Gdy ju? poznasz podstawy, nauczysz si? tak?e korzysta? ze wska?ników. To prawdziwa zmora wszystkich programistów, bowiem b??dne wykorzystanie wska?nika mo?e w okamgnieniu zrujnowa? Twój program. Zobacz, jak tego unikn?? i zaprzyja?ni? si? ze wska?nikami. Inne ksi??ki opisuj? wska?niki w jednym lub dwu rozdzia?ach, natomiast my po?wi?cili?my im ca?? ksi??k?. Dzi?ki temu dog??bnie poznasz ten mechanizm, zrozumiesz go i przekonasz si?,?e przy odrobinie uwagi nie jest on wcale taki straszny! W trakcie lektury

قیمت نهایی

۴۴٬۰۰۰ تومان