On this page
  1. Pointers & Pointer Arithmetic
  2. Contents
  3. Address-Of, Dereference & Scaled Arithmetic
  4. Reading const Pointer Declarations (Right-to-Left)
  5. void * & Double Pointers (T **)

Pointers & Pointer Arithmetic

Prev: pointers_and_memory | Up: pointers_and_memory | Next: Dynamic Memory & Allocators
Rel: Pointers, References & Indirection, Arrays & C Strings
Ref: cppreference — Pointer Declaration
Tags: #public #prog #c #pointers #memory


Contents


Address-Of, Dereference & Scaled Arithmetic

Adding 1 to T *p advances the address by sizeof(T) bytes, not 1 byte. Indexing p[i] is defined as *(p + i).

int nums[3] = {10, 20, 30};
int *p = nums;
int second = *(p + 1); // 20 (advances by sizeof(int) bytes)

Reading const Pointer Declarations (Right-to-Left)


void * & Double Pointers (T **)

Linked from

Related notes