Bifalgorithm post · Computer science one · Passing Arrays of Structures
How do you pass an array of pointers to structures to a function?
How do you pass an array of pointers to structures to a function? (Computer science one · Passing Arrays of Structures) — "Nevertheless, as we’ve previously se…
Ideas in this flowchart
- Computing the average GPA from an array of pointers to Student structures
- Maintaining an array of pointers can be preferable in this context.
- The function receives a roster of Student pointers and its size n.
- The running sum is initialized to 0.0.
- The loop processes each roster element while i is less than n.
- Each student's GPA is added to the running sum.
- The average is returned as sum divided by n.
- The gpa member is accessed with the arrow operator instead of the dot operator.