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.
Checking what this lesson needs for you…
What is inside Pointers to Structs and the Arrow Operator
- Maria's restock changed a copy
- A pointer to a struct
- The arrow operator
- Restock by pointer: the same program, changed in three places
- A read-only view with const
- Walking an array of records with a pointer
- By value, const pointer or pointer: how to choose