Launch offer
Business website $150 USD Custom plugin $200 USD Ready in 5 days
Get a quote
C Programming

Pointers to Structures in C

Access struct fields via pointers with ->.

Pointers to Structures in C — a practical guide to C pointers to structures with clear examples you can reuse in real projects.

C Programming Tutorial Series (59/102). Prefer one article? Read the complete C programming tutorial.

Short description

`p->x` is `(*p).x`.

Struct pointer

struct Point p = {1, 2};
struct Point *sp = &p;
printf("%dn", sp->x);

Leave a reply

Your email address will not be published. Required fields are marked *