Understanding and Using C Pointers [Book] - O'Reilly Media

文章推薦指數: 80 %
投票人數:10人

With this practical book, you'll learn how pointers provide the mechanism to dynamically manipulate memory, enhance support for data structures, and enable ... Skiptomaincontent GetfullaccesstoUnderstandingandUsingCPointersand60K+othertitles,withfree10-daytrialofO'Reilly. There'salsoliveonlineevents,interactivecontent,certificationprepmaterials,andmore. Startyourfreetrial UnderstandingandUsingCPointers byRichardMReese ReleasedMay2013 Publisher(s):O'ReillyMedia,Inc. ISBN:9781449344184 ReaditnowontheO’Reillylearningplatformwitha10-dayfreetrial. O’Reillymembersgetunlimitedaccesstoliveonlinetrainingexperiences,plusbooks,videos,anddigitalcontentfromO’Reillyandnearly200trustedpublishingpartners. BuyonAmazon Buyonebooks.com Startyourfreetrial Bookdescription ImproveyourprogrammingthroughasolidunderstandingofCpointersandmemorymanagement.Withthispracticalbook,you’lllearnhowpointersprovidethemechanismtodynamicallymanipulatememory,enhancesupportfordatastructures,andenableaccesstohardware.AuthorRichardReeseshowsyouhowtousepointerswitharrays,strings,structures,andfunctions,usingmemorymodelsthroughoutthebook.Difficulttomaster,pointersprovideCwithmuchflexibilityandpower—yetfewresourcesarededicatedtothisdatatype.Thiscomprehensivebookhastheinformationyouneed,whetheryou’reabeginneroranexperiencedCorC++programmerordeveloper.Getanintroductiontopointers,includingthedeclarationofdifferentpointertypesLearnaboutdynamicmemoryallocation,de-allocation,andalternativememorymanagementtechniquesUsetechniquesforpassingorreturningdatatoandfromfunctionsUnderstandthefundamentalaspectsofarraysastheyrelatetopointersExplorethebasicsofstringsandhowpointersareusedtosupportthemExaminewhypointerscanbethesourceofsecurityproblems,suchasbufferoverflowLearnseveralpointertechniques,suchastheuseofopaquepointers,boundedpointersand,therestrictkeyword Showandhidemore Publisherresources View/SubmitErrata TableofcontentsProductinformation Tableofcontents Preface WhyThisBookIsDifferent TheApproach Audience Organization Summary ConventionsUsedinThisBook UsingCodeExamples Safari®BooksOnline HowtoContactUs 1.Introduction PointersandMemory WhyYouShouldBecomeProficientwithPointers DeclaringPointers HowtoReadaDeclaration AddressofOperator DisplayingPointerValues Virtualmemoryandpointers DereferencingaPointerUsingtheIndirectionOperator PointerstoFunctions TheConceptofNull ToNULLornottoNULL Pointertovoid Globalandstaticpointers PointerSizeandTypes MemoryModels PredefinedPointer-RelatedTypes Understandingsize_t Usingthesizeofoperatorwithpointers Usingintptr_tanduintptr_t PointerOperators PointerArithmetic Addinganintegertoapointer Pointerstovoidandaddition Subtractinganintegerfromapointer Subtractingtwopointers ComparingPointers CommonUsesofPointers MultipleLevelsofIndirection ConstantsandPointers Pointerstoaconstant Constantpointerstononconstants Constantpointerstoconstants Pointerto(constantpointertoconstant) Summary 2.DynamicMemoryManagementinC DynamicMemoryAllocation MemoryLeaks Losingtheaddress Hiddenmemoryleaks DynamicMemoryAllocationFunctions UsingthemallocFunction Tocastornottocast Failingtoallocatememory Notusingtherightsizeforthemallocfunction Determiningtheamountofmemoryallocated Usingmallocwithstaticandglobalpointers UsingthecallocFunction UsingthereallocFunction TheallocaFunctionandVariableLengthArrays DeallocatingMemoryUsingthefreeFunction AssigningNULLtoaFreedPointer DoubleFree TheHeapandSystemMemory FreeingMemoryuponProgramTermination DanglingPointers DanglingPointerExamples DealingwithDanglingPointers DebugVersionSupportforDetectingMemoryLeaks DynamicMemoryAllocationTechnologies GarbageCollectioninC ResourceAcquisitionIsInitialization UsingExceptionHandlers Summary 3.PointersandFunctions ProgramStackandHeap ProgramStack OrganizationofaStackFrame PassingandReturningbyPointer PassingDataUsingaPointer PassingDatabyValue PassingaPointertoaConstant ReturningaPointer PointerstoLocalData PassingNullPointers PassingaPointertoaPointer Writingyourownfreefunction FunctionPointers DeclaringFunctionPointers UsingaFunctionPointer PassingFunctionPointers ReturningFunctionPointers UsinganArrayofFunctionPointers ComparingFunctionPointers CastingFunctionPointers Summary 4.PointersandArrays QuickReviewofArrays One-DimensionalArrays Two-DimensionalArrays MultidimensionalArrays PointerNotationandArrays DifferencesBetweenArraysandPointers UsingmalloctoCreateaOne-DimensionalArray UsingthereallocFunctiontoResizeanArray PassingaOne-DimensionalArray UsingArrayNotation UsingPointerNotation UsingaOne-DimensionalArrayofPointers PointersandMultidimensionalArrays PassingaMultidimensionalArray DynamicallyAllocatingaTwo-DimensionalArray AllocatingPotentiallyNoncontiguousMemory AllocatingContiguousMemory JaggedArraysandPointers Summary 5.PointersandStrings StringFundamentals StringDeclaration TheStringLiteralPool Whenastringliteralisnotaconstant StringInitialization Initializinganarrayofchar Initializingapointertoachar Initializingastringfromstandardinput Summaryofstringplacement StandardStringOperations ComparingStrings CopyingStrings ConcatenatingStrings PassingStrings PassingaSimpleString PassingaPointertoaConstantchar PassingaStringtoBeInitialized PassingArgumentstoanApplication ReturningStrings ReturningtheAddressofaLiteral ReturningtheAddressofDynamicallyAllocatedMemory Returningtheaddressofalocalstring FunctionPointersandStrings Summary 6.PointersandStructures Introduction HowMemoryIsAllocatedforaStructure StructureDeallocationIssues Avoidingmalloc/freeOverhead UsingPointerstoSupportDataStructures Single-LinkedList UsingPointerstoSupportaQueue UsingPointerstoSupportaStack UsingPointerstoSupportaTree Summary 7.SecurityIssuesandtheImproperUseofPointers PointerDeclarationandInitialization ImproperPointerDeclaration FailuretoInitializeaPointerBeforeItIsUsed DealingwithUninitializedPointers PointerUsageIssues TestforNULL MisuseoftheDereferenceOperator DanglingPointers AccessingMemoryOutsidetheBoundsofanArray CalculatingtheArraySizeIncorrectly MisusingthesizeofOperator AlwaysMatchPointerTypes BoundedPointers StringSecurityIssues PointerArithmeticandStructures FunctionPointerIssues MemoryDeallocationIssues DoubleFree ClearingSensitiveData UsingStaticAnalysisTools Summary 8.OddsandEnds CastingPointers AccessingaSpecialPurposeAddress AccessingaPort AccessingMemoryusingDMA DeterminingtheEndiannessofaMachine Aliasing,StrictAliasing,andtherestrictKeyword UsingaUniontoRepresentaValueinMultipleWays StrictAliasing UsingtherestrictKeyword ThreadsandPointers SharingPointersBetweenThreads UsingFunctionPointerstoSupportCallbacks Object-OrientedTechniques CreatingandUsinganOpaquePointer PolymorphisminC Summary Index AbouttheAuthor Colophon Copyright Showandhidemore Productinformation Title:UnderstandingandUsingCPointers Author(s):RichardMReese Releasedate:May2013 Publisher(s):O'ReillyMedia,Inc. ISBN:9781449344184 Youmightalsolike book 40AlgorithmsEveryProgrammerShouldKnow by ImranAhmad Learnalgorithmsforsolvingclassiccomputerscienceproblemswiththisconciseguidecoveringeverythingfromfundamental… book Hands-OnSystemProgrammingwithLinux by KaiwanNBillimoria GetupandrunningwithsystemprogrammingconceptsinLinuxKeyFeaturesAcquireinsightonLinux… book Hands-OnNetworkProgrammingwithC by LewisVanWinkle Acomprehensiveguidetoprogrammingwithnetworksockets,implementingInternetprotocols,designingIoTdevices,andmuch… book ExtremeC by KamranAmini PushthelimitsofwhatC-andyou-cando,withthishigh-intensityguide… Don’tleaveempty-handed GetMarkRichards’sSoftwareArchitecturePatternsebooktobetterunderstandhowtodesigncomponents—andhowtheyshouldinteract. It’syours,free. Getitnow Close



請為這篇文章評分?