Understanding and Using C Pointers

MOC Programming

Created: 2022-07-10
Tags: #fleeting


Abstract:


Plans on how to read the book

  • Everytime you read a new chapter
    -> Read the Preface part first in pg 13 or XI

Conventions used on the book

Italic
-> New terms, URLS, email,
-> filenames AND file extensions

C o n s t a n t W i d t h
-> program listings
-> within paragraphs that refer to program elements
-> such as variable/function, databases, data types, statements and keywords

C o n s t a n t W i d t h b o l d
-> Should be typed by user

C o n s t a n t W i d t h b o l d
-> text that should be replaced w/ user input or values by context

Let's start!

Pointers can be difficult to master

Stack is used to support functions
Heap is used to support dynamic memory allocation

Understanding stack frames helps clarifies concepts

  • passing by value
  • passing by pointer
  • how recursion works

Key to understand pointers

  • Understand how memory is managed in C
    After all, pointers contain the address of memory.
    If we don't understand how memory is organized/managed,
    it's difficult to understand how pointers work.