Skip to main content

Pointer with Structure in C

A pointer to a structure stores the address of a structure variable. It allows you to access and modify structure members through the pointer using the arrow operator (->).

Syntax


Arrow Operator (->)

When accessing members through a pointer, use -> instead of .:

Example: Pointer to Structure

Output:

Modifying Members via Pointer


Dot (.) vs Arrow (->)

Both are equivalent:

Passing Structure Pointer to a Function

This is the preferred way to pass structures — no copying, direct modification possible.