Learn C Programming

Lesson 3 of 9 · Structures, Unions and Enums

Module 12 · Structures, Unions and Enums

Pointers to Structs and the Arrow Operator

Free with an accountReading

A delivery reaches Maria's shop: 25 more bags of rice. She writes a function called restock that adds them to the rice record. Inside the function, the stock reads 65. Back in main, it still reads 40.

Sign in to read

This lesson is free, with an account

An account costs nothing and opens every lesson in this track that is not marked Pro, on every device you read on.

What is inside Pointers to Structs and the Arrow Operator

  1. Maria's restock changed a copy
  2. A pointer to a struct
  3. The arrow operator
  4. Restock by pointer: the same program, changed in three places
  5. A read-only view with const
  6. Walking an array of records with a pointer
  7. By value, const pointer or pointer: how to choose