C in 100 Seconds: Walk an Array With a Pointer — Pointer Arithmetic | Episode 18

4views
00
2:23
T
Taught by Celeste AI - AI Coding Coach
View on YouTube
Description
When you add one to a pointer, it doesn't move one byte — it moves one element. An int pointer jumps four bytes because that's the size of an int. Arrays and pointers are interchangeable — the array name is just a pointer to the first element. ptr plus one gives you the second element. ptr plus three jumps to the fourth. Walk through an entire array using nothing but a pointer and a loop — same result as bracket notation, but with raw pointer math. Student code: https://github.com/GoCelesteAI/c-in-100-seconds/tree/main/episode18 What You'll Learn: • Array names are pointers to the first element • ptr + 1 moves by one element, not one byte • *(ptr + i) is the same as nums[i] • Walking arrays with pointer arithmetic in a loop Next: Episode 19 — Pass by Reference #c #programming #100seconds #learnc #pointers #pointerarithmetic #arrays #memory #tutorial Tags c pointer arithmetic, ptr + 1 c, array pointer equivalence, walking memory c, dereference pointer, c tutorial 2026, c beginner, 100 seconds, learn c, coding tutorial

Tags

c pointer arithmeticptr + 1 carray pointer equivalencewalking memory cdereference pointerc tutorial 2026c beginner100 secondslearn ccoding tutorial
Back to tutorials

Duration

2:23

Published

April 8, 2026

Added to Codegiz

April 10, 2026

Open in YouTube