惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
D
DataBreaches.Net
C
Check Point Blog
I
InfoQ
A
About on SuperTechFans
Engineering at Meta
Engineering at Meta
月光博客
月光博客
Recent Announcements
Recent Announcements
酷 壳 – CoolShell
酷 壳 – CoolShell
T
Tailwind CSS Blog
Y
Y Combinator Blog
博客园 - Franky
博客园_首页
罗磊的独立博客
量子位
美团技术团队
T
The Blog of Author Tim Ferriss
Last Week in AI
Last Week in AI
大猫的无限游戏
大猫的无限游戏
爱范儿
爱范儿
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Martin Fowler
Martin Fowler
博客园 - 叶小钗
aimingoo的专栏
aimingoo的专栏

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Pointers in C: The Concept That Almost Broke Me (And How ...
Okeke Chukwu · 2026-05-15 · via DEV Community

Some concepts in programming slide into your brain smoothly. You read the definition, look at an example, and think, "Okay, I get it."

Pointers are not that concept.

For weeks, pointers felt like a wall I couldn't climb. Every explanation sounded the same: "A pointer stores a memory address." Cool. But why? When? What problem does this actually solve?

This post is for anyone staring at int *ptr and wondering if they're just not cut out for this. You are. The problem isn't you. The problem is that most explanations skip the "why" and jump straight to the syntax.

The Real Question: Why Do Pointers Exist?

Imagine you're a chef. You have a recipe book (your program) and a kitchen full of ingredients (your computer's memory).

Without pointers, every time a function needs an ingredient, you photocopy the entire recipe and hand over a duplicate of everything. Need to modify one onion? Here's a copy of the whole kitchen. This is slow, wasteful, and the original onion stays untouched.

With pointers, you don't hand over a copy. You hand over a note with the exact shelf and position where the onion lives. The function goes straight to the source, works on the original onion, and leaves.

That's what pointers do. They pass addresses instead of copies.

The Syntax Demystified

Let's break down the three things that confused me the most.

int x = 10; — This is a normal variable. It holds a value.

int *ptr = &x; — This is a pointer. &x means "give me the address of x." *ptr means "ptr is a variable that stores an address." So ptr now holds the memory location where x lives.

*ptr = 20; — This is dereferencing. *ptr means "go to the address stored in ptr and access the value there." So this line changes x to 20 without ever typing x.

int x = 10;
int *ptr = &x;   // ptr holds the address of x
*ptr = 20;       // x is now 20
printf("%d", x); // prints 20

Enter fullscreen mode Exit fullscreen mode

The Moment It Clicked

It didn't click from reading. It clicked when I wrote a tiny, useless program and watched it fail.

I tried to write a function that swaps two numbers. Without pointers, nothing happened. The values stayed the same. With pointers, the swap worked.

// This does NOT work
void swap(int a, int b) {
    int temp = a;
    a = b;
    b = temp;
}

// This works
void swap(int *a, int *b) {
    int temp = *a;
    *a = *b;
    *b = temp;
}

Enter fullscreen mode Exit fullscreen mode

The first version copies the values. The second version goes to the addresses and changes the originals. That was the moment. Not elegant theory. A broken function that pointers fixed.

What I'd Tell My Past Self

Stop trying to memorize the syntax. Write a program that breaks. Use pointers to fix it. The understanding doesn't come from reading. It comes from watching your program fail and knowing exactly why pointers would have saved it.

You're not bad at this. Pointers are just one of those things that takes longer to click than the tutorials admit.