HexLibraryHexLibrary
</> HexCodeSign inSign up
PythonJavaScriptTypeScriptCC++JavaPHPGoRustRubyBashSQLLuaPerlCOBOLPascalDelphiFortranDartSwiftC#JuliaGroovyRElixirHaskellKotlinScalaClassic ASPClipperMS-DOS
LESSONS
Introduction to CVariablesData TypesOperatorsStringsArraysConditions (if / switch)Loops (for / while)FunctionsPointers
REFERENCE
📖 Overview
🖥️ Output & Input
📦 Variables
🔢 Numbers & Math
✍️ String
📋 Array
🔁 Condition & Loop
🧩 Function
👉 Pointer
Pointer ( * and & )Passing a pointer to a function
C›REFERENCE›Pointer›Pointer ( * and & )

Pointer ( * and & )

Holds the address of a variable.

Syntax

type *p = &variable;

Description

& gives the ADDRESS of a variable; * accesses the VALUE at that address. Pointers are C's most powerful and demanding feature.

Example

Loading editor…

Expected output

10
20

When to use?

Passing data to a function by reference, dynamic memory, arrays.

Common mistakes

  • ⚠️ & gets the address, * accesses the value — don't mix them up.
  • ⚠️ Reading an uninitialized pointer (*p) causes a crash.

Related commands

Passing a pointer to a function
Passing a pointer to a function →
HexLibraryHexLibrary

Learn programming more clearly. Every command is explained line by line with colors, reinforced with runnable exercises, test your code instantly — all in one place, free.

Learn

  • Home
  • Languages & Lessons
  • HexCode

Company

  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Use

Other Projects

  • HexToolz
  • Free Service Manuals
© 2026 HexLibrary · The clearest way to learn code